From f5a8d1dc263d6785325e3f7369a3aa9988254ebd Mon Sep 17 00:00:00 2001 From: jacamera Date: Wed, 8 Jul 2020 00:19:28 -0400 Subject: [PATCH] updated webpack configuration instructions (#574) --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ac497b6f..0cd5757f 100644 --- a/README.md +++ b/README.md @@ -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