Closed nabiltntn closed 8 years ago
@nabiltntn you need to use require
inside an if
like so:
if (Meteor.isServer) {
const { MailingUtils } = require('/server/mailing.js');
// do stuff
}
This is because according to the ES2015 standard you aren't allowed to have import
statements that aren't at the root of the file.
@benjamn, did I get it right?
@tmeasday, we should add this to the guide when we migrate the code samples to 1.3.
Closing in favor of: https://github.com/meteor/guide/issues/338
As recommended in the Meteor guide, it's better for security reasons to define sensitive code in server side and call it in method code in
Meteor.isServer
block. How it's possible to apply such recommendations with Meteor 1.3 with the given example. Suppose we have underboth
folder the given method :And under server folder the actual implementation of the sensitive code
On the browser console, i have and error message loading the
/server/mailing.js
module