From 7e26e8d47d6f46482509e5395e551c624ad4293a Mon Sep 17 00:00:00 2001 From: hensm Date: Fri, 7 Dec 2018 20:51:24 +0000 Subject: [PATCH] Split React into separate chunk to reduce bundle sizes --- ext/src/options/index.html | 1 + ext/src/popup/index.html | 23 ++++++++++++----------- ext/webpack.config.js | 11 +++++++++++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ext/src/options/index.html b/ext/src/options/index.html index 4754571..5219cde 100644 --- a/ext/src/options/index.html +++ b/ext/src/options/index.html @@ -3,6 +3,7 @@ + diff --git a/ext/src/popup/index.html b/ext/src/popup/index.html index 2821f73..02ca7fc 100755 --- a/ext/src/popup/index.html +++ b/ext/src/popup/index.html @@ -1,11 +1,12 @@ - - - - - - - - -
- - \ No newline at end of file + + + + + + + + + +
+ + diff --git a/ext/webpack.config.js b/ext/webpack.config.js index 3d63c6a..2ab696a 100755 --- a/ext/webpack.config.js +++ b/ext/webpack.config.js @@ -23,6 +23,17 @@ module.exports = (env) => ({ filename: "[name].js" , path: `${env.outputPath}` } + , optimization: { + splitChunks: { + cacheGroups: { + vendor: { + name: "vendor" + , test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/ + , chunks: "all" + } + } + } + } , plugins: [ new webpack.DefinePlugin({ "EXTENSION_NAME" : JSON.stringify(env.extensionName)