Using the meteor build system to build specific modules into a separate file

Hi,

To use web workers in my app, I need a standalone file to load for the worker thread.

To build that file without losing all the Babel/ES6 module and syntax transpilation, I need to figure out a way to configure meteor to say: “build a new output file, worker.js, by starting with this specific module, imports/workermain.js that in turn might import all sorts of other npm and local modules and use other Babel ES6 features”.

Is this possible? I could probably set up something completely separate with gulp and babel and whatever but this feels quite brittle and painful.

Martin

One way to do it is to create your own standard standard-minifier-js. This package knows every files compiled within your app allowing you to decide in which file your would like to bundle it.

We have created our own for increasing minification: https://ssrwpo.github.io/uglifyjs2/description/

PS: We intend to push this a bit forward for allowing service workers, code splitting and tree walking as well. If you’re interested, it should be nice to join our efforts. We are relying heavily on React, Redux, Express & React Router 4 for our apps.