Meteor package structure (client / server)

I am creating a meteor pack. I noticed that in the package, even if I put my code in the server directory, the code starts the client. What is the pattern used in packages to split code? Should I rely only on packaging the code with Meteor.isServer? Is there any configuration for package.js?

+4
source share
1 answer

Packages do not rely on a specific application-level file structure responsible for conditional loading and download order; on the contrary, you must specify which files are downloaded first and on which architecture.

You can do this using the package APIs, in particular use this:

https://docs.meteor.com/#/full/pack_addFiles

Package.onUse(function(api){
  // ...
  api.addFiles("server/server.js","server");
  // ...
});

/, , / .

+5

Source: https://habr.com/ru/post/1568862/


All Articles