The docs mention things like
import Meteor from 'meteor/meteor'
under the headings. These are completely optional right now, as we can update a vanilla 1.2 app to 1.3 and it will still work because everything is still a global, and so importing stuff doesn’t really add any benefits (or does it?) other than what you read at the top of your files.
Is there a plan to require this form at some point and completely remove globals?
I think right now the main benefit of using imports is:
- You can use a linter that detects undefined variables. Previously you would have to list all of your “globals” at the top of each file.
- You document which packages you are using. Otherwise if someone uses a random global function it’s not clear which package that came from.
Personally I love using imports just for the self-documenting aspect.
No matter what happens, you’ll always be able to have some file called
globals.js that just says
global.Meteor = require('meteor/meteor'); Other than that, I don’t know what the plans are for future Meteor releases since 1.3 just launched, but there are a lot of great features that are only really possible with explicit imports, like code splitting and dead code elimination.