From b7e7f2bfe974f810513bb5be307d5cd15517b79d Mon Sep 17 00:00:00 2001 From: eliot-akira Date: Wed, 11 Aug 2021 20:50:46 +0200 Subject: [PATCH] Optimize browser build by replacing "byline" with empty object --- browser-version/lib/byline.js | 1 + webpack.config.js | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) create mode 100644 browser-version/lib/byline.js diff --git a/browser-version/lib/byline.js b/browser-version/lib/byline.js new file mode 100644 index 0000000..7c6d6c7 --- /dev/null +++ b/browser-version/lib/byline.js @@ -0,0 +1 @@ +module.exports = {} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 7e49484..f3b76fb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -21,17 +21,13 @@ module.exports = (env, argv) => { fs: false, path: require.resolve('path-browserify'), events: require.resolve('events/'), - crypto: false, - // Following used by `byline` on server side only - stream: false, - util: require.resolve('util/'), - timers: false, - buffer: false + crypto: false } }, plugins: [ new webpack.NormalModuleReplacementPlugin(new RegExp(path.resolve(__dirname, 'lib/storage.js')), path.resolve(__dirname, 'browser-version/lib/storage.js')), new webpack.NormalModuleReplacementPlugin(new RegExp(path.resolve(__dirname, 'lib/customUtils.js')), path.resolve(__dirname, 'browser-version/lib/customUtils.js')), + new webpack.NormalModuleReplacementPlugin(new RegExp('byline'), path.resolve(__dirname, 'browser-version/lib/byline.js')), new webpack.ProvidePlugin({ process: 'process/browser', Buffer: ['buffer', 'Buffer'],