File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -116,14 +116,28 @@ Since rewire relies heavily on node's require mechanism it can't be used on the
116116###browserify
117117
118118``` javascript
119- var b = browserify ();
119+ var b = browserify (),
120+ bundleSrc;
121+
122+ // Add rewire as browserify middleware
123+ // @see https://github.com/substack/node-browserify/blob/master/doc/methods.markdown#busefn
120124b .use (require (" rewire" ).bundlers .browserify );
125+
126+ b .addEntry (" entry.js" );
127+ bundleSrc = b .bundle ();
121128```
122129
123130###webpack
124131
125132``` javascript
126- var options = {};
133+ var webpackOptions = {
134+ output: " bundle.js"
135+ };
136+
137+ // This function modifies the webpack options object.
138+ // It adds a postLoader and postProcessor to the bundling process.
139+ // @see https://github.com/webpack/webpack#programmatically-usage
140+ require (" rewire" ).bundlers .webpack (webpackOptions);
127141
128- require ( " rewire " ). bundlers . webpack (options );
142+ webpack ( " entry.js " , webpackOptions, function () {} );
129143```
You can’t perform that action at this time.
0 commit comments