The broccoli-watchify plugin bundles your assets with watchify.
npm install --save-dev broccoli-watchify
const watchify = require('broccoli-watchify');
const options = {
browserify: {
entries: ['./app.js'],
debug: true
},
nodeModulesPath: process.cwd() + '/node_modules', // provide the node_modules you want to resolve from
outputFile: 'bundled/app.js',
cache: true,
init: function (b) {
b.transform('reactify', {'es6': true});
b.external('$');
}
};
const tree = watchify(tree, options);
tree
: A broccoli tree or a directory path as a stringbrowserify
: (defaults to {}
) Options passed to the browserify constructoroutputFile
: (defaults to "./browserify.js"
) Output filecache
: (defaults to true
) A boolean flag to potentially switch the caching off and act like a plain browserify. Can be helpful in assembling bundles for production and not including all the full local path names in the bundle, which is not possible in the watchify mode.init
: (defaults to a no-op) A callback function that receives the browserify instance after it's created. Use this to call any of the browserify API methods on the instance, including add
, require
, external
, exclude
and so on.nodeModulesPath
: (defaults to process.cwd()/node_modules
) Absolute path to node_modules.inputPath
, not the realpath.init
option to provide a possibility of configuration of the browserify instance with a custom function.entries
and require
options.cache
option to turn off the watchify behavior and act like a plain browserify.The code of this plugin is originally based on the broccoli-browserify plugin by Gareth Andrew.
The MIT License (MIT). See LICENSE for details.
Copyright © 2014 Andrey Subbotin.