1

I have an npm module I want to wrap in Meteor package, and work with it on client side and server side both. This npm module isn't shipped with built 'dist' file but with sources only instead and npm build script, so it is supposed to be built with browserify or webpack.

package.json contains npm build script for minimized package:

"scripts": {
    "prod": "browserify ./index.js -x react | uglifyjs > ./dev/prod.js"
},

I want to execute this script (or my own) and only then do

Package.onUse(function(api) {
    api.addFiles('../somenpmfolder???/dev/prod.js', ['client', 'server']);
}

Obviously just Npm.require wouldn't work as it doesn't work when executed on client.

I can build script manually and just shove dist inside my package but it isn't right way doing things. I leave it as a last resort for myself.

This is half of answer on my question: https://stackoverflow.com/a/17081463/2123547

What I want to have next is this pre-build stage.

Community
  • 1
  • 1
Igor Loskutov
  • 2,157
  • 2
  • 20
  • 33

1 Answers1

1

There's a new package appeared that does browserify job. I checked it and it work well for me.

https://github.com/elidoran/cosmos-browserify/

Igor Loskutov
  • 2,157
  • 2
  • 20
  • 33