I currently use a package.json with some devDependencies (for some linting tools) and I noted in the current 1.2 docs that:
For compatibility with node.js tools used alongside Meteor, any directory named node_modules is not loaded anywhere. node.js packages installed into node_modules directories will not be available to your Meteor code.
So this will be different in 1.3. If I move all my meteorhacks:npm packages into package.json and run an npm install then Meteor will now be reading everything in node_modules. I guess that as my current modules are devDependencies that this actually is okay.
@timfletcher That statement is essentially still valid with a new exception: files from node_modules won’t be loaded automatically, just as before, unless you explicitly load them with an import or require statement somewhere in your code. If you never import anything from node_modules, then those files will never load. However, if you have files outside of node_modules that you aren’t importing anywhere, then those files will be loaded automatically by Meteor unless they are inside any folder named imports.
EDIT: Actually, I just got it working without having to touch browserify at all… Not sure if I’m doing it right but that was the last step in my port to 1.3! Loving the speedy build although my app is still pretty small.
I wouldn’t call my project a boilerplate or even a clean project (after the multiple refactors in the last month) but at least it’s finally running on 1.3 with a bit of react/redux sprinkled on and I can move on to actually adding content! YAYAYA!!
If you have the redux chrome extension, you can see Tracker updating the store with meteor subscription data (on game creation) as it comes back to minimongo . This way, I keep all client state in the store, propagate any updates to components via props thus keeping them pure and easy to unit test.
I’d like to reiterate a question that was asked earlier - how will this work with importing the same NPM package in multiple Meteor packages? Will the dependency tree be managed to ensure only one copy of each library is included?
@clayne Great question, and thanks for reiterating it. My current plan (slightly different from what’s implemented in the latest beta release) is that the top-level node_modules/ directory in an app will provide importable packages not only for application code but also for Meteor packages. In other words, the app gets to decide which version of an npm package will be used throughout the app and its packages. Packages can still use Npm.depends to install their own local dependencies, but they can also import or require npm dependencies that they did not explicitly install, with the expectation that the application will provide those dependencies.
So, to answer your question: no, the dependency tree will not be managed by Meteor, and there will be no special enforcement of single installation, but it should be straightforward for the app to provide a single version of a common dependency.
This will work alright in the case of a package that I write myself, but what about if I want to release a package on Atmosphere?
Will there be a way to tell the compiler that a certain package is required as a top-level NPM package, or to have something like a weak Npm.depends such that if the if the NPM package is included at the top level, it doesn’t get included, otherwise it does?
@clayne I think these questions deserve their own forum thread, if you wouldn’t mind starting a new topic. I have some ideas, and I’m sure you do too, but I don’t want this discussion getting lost in the larger 1.3 announcement thread.
Hey folks, as of today I’m getting back to work after some holiday downtime, and I’m hoping to spend this week responding to all the feedback and ideas above. Thanks for all the input, and for your patience!
This thread has gotten rather long, so if there’s something I don’t respond to in the next few days, don’t hesitate to resurface it. If it feels like a distinct topic, starting a new thread might be a good idea. Just @mention me and link back to the original post(s).
Yep, that’s the plan for 1.3: you have complete control over the contents of node_modules directories in your app, and Meteor will bundle those modules into your app when you deploy.
Future releases may introduce new features that help with managing npm dependencies, but we believe that can wait until after 1.3.
Cool stuff. Two package managers feels so dirty, but hopefully this will work out.
I don’t know what the deal is, but the imports/ directory thing is definitely not working for me. Maybe I’m just stupid. Tried /imports/, /server/imports/, /client/imports/, but files in those folders still get eager-loaded.
But I like this. It’s better than I expected. Well done.