Reputation: 73
I'm building a meteor package I noticed that in a package even if I put my code in server directory the code runs @ the client . What's the pattern used in packages to separate code ? Should I rely only on wrapping the code with Meteor.isServer
? Is there a configuration for package.js ?
Upvotes: 4
Views: 468
Reputation: 22696
Packages do not rely on application level specific file structure responsible for conditional loading and load order, on the contrary you have to specify which files are loaded first and on which architecture.
You can do so using the Packages API, in particular use this :
https://docs.meteor.com/#/full/pack_addFiles
Package.onUse(function(api){
// ...
api.addFiles("server/server.js","server");
// ...
});
There is nothing preventing you to adopt the application file structure with client/server directories, just remember that it has no impact on actual file adding/loading control logic.
Upvotes: 5