Update README.md to use webpack noParse
Now with webpack 2 there's no need to write a shim for the modules. Just tell webpack to not parse them.
This commit is contained in:
parent
e540a76424
commit
3e085f2fdb
1 changed files with 7 additions and 15 deletions
22
README.md
22
README.md
|
@ -1376,26 +1376,18 @@ log.info('hi on info');
|
|||
|
||||
## Webpack
|
||||
Webpack can work with the same example Browserify above. To do this, we need to make webpack ignore optional files:
|
||||
Create "empty_shim.js":
|
||||
```javascript
|
||||
// This is an empty shim for things that should be not be included in webpack
|
||||
|
||||
```
|
||||
Now tell webpack to use this file for
|
||||
[optional dependencies](https://webpack.github.io/docs/configuration.html#resolve-alias)
|
||||
Now tell webpack to ignore files for
|
||||
[optional dependencies](https://webpack.js.org/configuration/module/#module-noparse)
|
||||
in your "webpack.config.js":
|
||||
```
|
||||
resolve: {
|
||||
// These shims are needed for bunyan
|
||||
alias: {
|
||||
'dtrace-provider': '/path/to/shim/empty_shim.js',
|
||||
fs: '/path/to/shim/empty_shim.js',
|
||||
'safe-json-stringify': '/path/to/shim/empty_shim.js',
|
||||
mv: '/path/to/shim/empty_shim.js',
|
||||
'source-map-support': '/path/to/shim/empty_shim.js'
|
||||
}
|
||||
module: {
|
||||
noParse: [/dtrace-provider$/, /safe-json-stringify$/, /mv/],
|
||||
...
|
||||
}
|
||||
```
|
||||
Now webpack builds, ignoring these optional dependencies via shimming in an empty JS file!
|
||||
Now webpack builds.
|
||||
|
||||
# Versioning
|
||||
|
||||
|
|
Loading…
Reference in a new issue