The Meteor guide 1.3 says that : " Any directory named imports/ is not loaded anywhere and files must be imported using import". I just tried putting in “imports/common/” directory a JS file that was previously automatically loaded from another directory. It still remains automatically loaded without import. Is there anything wrong in my understanding ?
It’s difficult to say without seeing your code, but here a few things to check:
- Make sure you don’t have any typos in your
importsdirectory name (like missing an
- Make sure you aren’t still loading the file outside of the
- Make sure you aren’t already loading the file from another
import(maybe you’re already importing it somewhere else).
- Make sure your locally built app isn’t out of synch with your codebase somehow (you might have older eagerly loaded code somewhere within your app’s
.meteor/local/builddir); you can try a
meteor resetto help with this (warning: will wipe your local DB).
Thanks a lot for your answer. At first glance I don’t see any problem with a qucik check of your points. The problem seems to be the same even after a meteor reset. However, I will check everything again !
The behaviour I see is that imports are just not run automatically, but they are parsed and loaded into
modules.js at runtime. This is all well and good, but it also means you cannot just plop some test code or temporary private JS files with some passwords or sensitive information that you can swap in and out as they are going to be visible when you view source.
In addition the bug I raised at https://github.com/meteor/meteor/issues/6836 indicates that node_modules are also parsed, including
devDependencies so watch out for that.