Browserify

It is good at creating more than one bundle, but it cannot watch the directory and recreate a bundle. At least it does not appear to work.

Note

On Linux try running with sudo to get watch functionality working.

  1. Browserify syntax
  2. Babelify syntax
  3. Using babel

Example building two bundles

GNUMakefile

browserify=node_modules/browserify/bin/cmd.js
uglifyjs=node_modules/uglifyjs/bin/uglifyjs

bextr=-r redux -r react -r react-dom -r react-redux -r redux-thunk -r react-google-charts
bextx=-x redux -x react -x react-dom -x react-redux -x redux-thunk -x react-google-charts

bundle-index: $(out) $(lib)
        $(browserify) $(out)/*.js -o $(lib)/bundle-index.js $(bextx)

bundle-external: $(lib)
  $(browserify) $(bextr) -o $(lib)/bundle-external.js
        $(uglifyjs) $(lib)/bundle-external.js > $(lib)/bundle-external.min.js