diff options
author | Johannes <mail@johannesewald.de> | 2012-08-20 19:55:06 +0400 |
---|---|---|
committer | Johannes <mail@johannesewald.de> | 2012-08-20 19:55:06 +0400 |
commit | 5ebeb1b83b1c9159e9eb77843d245457c3ade7b0 (patch) | |
tree | 2d824dfbdbff5656ad038ab64f72dcb693dc57dc | |
parent | d6889ee0eff962d0336a766d6009be0ac9bbce53 (diff) |
- Improved client-side bundling chapter
-rw-r--r-- | README.md | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -116,14 +116,28 @@ Since rewire relies heavily on node's require mechanism it can't be used on the ###browserify ```javascript -var b = browserify(); +var b = browserify(), + bundleSrc; + +// Add rewire as browserify middleware +// @see https://github.com/substack/node-browserify/blob/master/doc/methods.markdown#busefn b.use(require("rewire").bundlers.browserify); + +b.addEntry("entry.js"); +bundleSrc = b.bundle(); ``` ###webpack ```javascript -var options = {}; +var webpackOptions = { + output: "bundle.js" +}; + +// This function modifies the webpack options object. +// It adds a postLoader and postProcessor to the bundling process. +// @see https://github.com/webpack/webpack#programmatically-usage +require("rewire").bundlers.webpack(webpackOptions); -require("rewire").bundlers.webpack(options); +webpack("entry.js", webpackOptions, function () {}); ```
\ No newline at end of file |