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
116
116
###browserify
117
117
118
118
``` 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
120
124
b .use (require (" rewire" ).bundlers .browserify );
125
+
126
+ b .addEntry (" entry.js" );
127
+ bundleSrc = b .bundle ();
121
128
```
122
129
123
130
###webpack
124
131
125
132
``` 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);
127
141
128
- require ( " rewire " ). bundlers . webpack (options );
142
+ webpack ( " entry.js " , webpackOptions, function () {} );
129
143
```
You can’t perform that action at this time.
0 commit comments