Hello,
Since the Meteor v3, it seems that some global variables are not globally imported/exported to client and server anymore.
For example with meteor version 2.15, using Session
on the client wihtout importing it was working well.
Now I need to write import { Session } from 'meteor/session';
on top of all my template.js files.
The same on the server.
I need to import import { check, Match } from 'meteor/check';
and also Roles and other.
Is this normal, do you advice to manually add it on top on all files ? or is there a way to export them everywhere at once ?
Thanks
According to my experience in the minus versions, if your project is large and you are working with more than one staff, there is a problem when the code references of the global imported variables are not correct. This issue is more valid for the global variable you wrote yourself. I use svelte in my projects and automatic type definitions make my job very easy. Of course, importing is a bit troublesome ![:sweat_smile: :sweat_smile:](https://forums.meteor.com/images/emoji/twitter/sweat_smile.png?v=12)
I guess it depends on the project as @receptim points out. I’d rather have to be explicit by default. Not sure how easy it is to configure new globals with Meteor’s bundler in v3.
You are right. It is better to explicitly import modules in the files where we need it. I will do it like this.