Skip to content

Commit

Permalink
updated webpack configuration instructions (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacamera authored Jul 8, 2020
1 parent 7641566 commit f5a8d1d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1380,19 +1380,19 @@ var log = bunyan.createLogger({
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:
## webpack
To include bunyan in your webpack bundle you need to tell webpack to
ignore the optional dependencies that are unavailable in browser environments.
Mark the following dependencies as
[externals](https://webpack.js.org/configuration/externals/) in your webpack
configuration file to exclude them from the bundle:
Now tell webpack to ignore files for
[optional dependencies](https://webpack.js.org/configuration/module/#module-noparse)
in your "webpack.config.js":
```
module: {
noParse: [/dtrace-provider$/, /safe-json-stringify$/, /mv/],
...
externals: ['dtrace-provider', 'fs', 'mv', 'os', 'source-map-support']
}
```
Now webpack builds.
# Versioning
Expand Down

0 comments on commit f5a8d1d

Please sign in to comment.