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
|
||||||
Webpack can work with the same example Browserify above. To do this, we need to make webpack ignore optional files:
|
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
|
Now tell webpack to ignore files for
|
||||||
[optional dependencies](https://webpack.github.io/docs/configuration.html#resolve-alias)
|
[optional dependencies](https://webpack.js.org/configuration/module/#module-noparse)
|
||||||
in your "webpack.config.js":
|
in your "webpack.config.js":
|
||||||
```
|
```
|
||||||
resolve: {
|
module: {
|
||||||
// These shims are needed for bunyan
|
noParse: [/dtrace-provider$/, /safe-json-stringify$/, /mv/],
|
||||||
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'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Now webpack builds, ignoring these optional dependencies via shimming in an empty JS file!
|
Now webpack builds.
|
||||||
|
|
||||||
# Versioning
|
# Versioning
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue