Does the client code on demand download the latest version (0.9.x) of Meteor?

I am considering using Meteor to build a real-time data application as Meteor does so many real-time updates and other related stuff. The only thing that stops me is that Meteor downloads all files (except files in public and server folders) to the client. Let's say I am developing a very large application containing so many modules. For some users, only certain modules will be available. Thus, all code related to other modules will be loaded unnecessarily. The initial loading of the page will also take a long time. There may be security problems.

I tried to use the IRLibloader plugin to load JS files by placing them in a public folder. So, is there a way to configure Meteor to only load the code it needs, and then load the code for other modules as needed? If this is not possible, can you please guide me to other useful practices using Meteor.

Thanks in advance.

+3


source to share


1 answer


It is possible. The complete solution is the package anti:modules

. First add it to your application:

meteor add anti:modules

      

Then create a folder /layers

inside your project and put your additional files in your subfolder:

/
  layers
    fancyModule
      someFile.module.js
      anotherFile.module.js
      ...

      



Then, in your code, create a global module:

theApp = Module('$global').as('myApp');

      

and load it if needed:

theApp.require('fancyModule', function () {
  console.log('fancyModule code loaded');
});

      

+2


source







All Articles