Primer on ES6, Modules and Meteor Imports


#1

I don’t very little about ES6, ES6 Modules or Imports.

My project is on Meteor 1.3.5.1, has no ES6 syntax, no imports. How can I slowly migrate my code to use ES6 syntax and Modules and Imports? Also, why do things work without imports and why should I add in imports?

Where can I find a good primer on how all these work together, within Meteor?


#2

Read the guide, that’s the best pointer.

About why it still works: that’s based on the principle of meteor that updates should not break things uselessly.

As far as I am concerned i don’t see a fully decided stable way of using es6 modules. Personally I would wait a bit unless you need npm modules for your project.

The currently suggested structure is in the guide but the discussion on the forum on things like viewModel are also interesting.


#3

Will you explain this more, why are es6 modules unstable? What about using Imports, everything is working as is, so why add them?


#4

Yes it’s stable working. But there is also some discussion going on how to use it in practice. So if you start a new project or want to invest in it now go for it. If you have a good running project maybe focus on work which adds value to the project itself. Currently it’s not yet “needed” to move.

It’s a priority issue. technically I think it works stable, for sure if you follow the guide.


#5

https://guide.meteor.com/structure.html#importing-meteor-globals This is the interesting part why it still works btw.