From 8602c34825657b4186419b577d339b0b6fbcb613 Mon Sep 17 00:00:00 2001 From: Ealhad Date: Sun, 4 Nov 2018 09:06:02 +0100 Subject: [PATCH] Enable webpack code splitting to drastically reduce package size 4x lodash was a bit too much, I think. --- extension/manifest.json | 6 +++--- src/options.html | 1 + webpack.config.js | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/extension/manifest.json b/extension/manifest.json index fc6bdab..3c79b29 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -15,14 +15,14 @@ "" ], "background": { - "scripts": ["dist/background.js"] + "scripts": ["dist/background.js", "dist/vendors.js"] }, "content_scripts": [{ "matches": ["*://*.youtube.com/*"], - "js": ["dist/youtube.js"] + "js": ["dist/youtube.js", "dist/vendors.js"] }, { "matches": ["https://*/videos/watch/*"], - "js": ["dist/peertube.js"] + "js": ["dist/peertube.js", "dist/vendors.js"] }], "options_ui": { "page": "dist/options.html" diff --git a/src/options.html b/src/options.html index faeaf65..8f8b78d 100644 --- a/src/options.html +++ b/src/options.html @@ -32,6 +32,7 @@ + diff --git a/webpack.config.js b/webpack.config.js index c00ede9..572d0a7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,6 +8,12 @@ module.exports = { peertube: 'peertube.ts', options: ['options.ts', 'options.html'], }, + optimization: { + splitChunks: { + chunks: 'all', + name: 'vendors' + } + }, output: { path: path.join(__dirname, 'extension', 'dist'), filename: '[name].js',