Enable webpack code splitting to drastically reduce package size

4x lodash was a bit too much, I think.
This commit is contained in:
Ealhad 2018-11-04 09:06:02 +01:00
parent f197253e52
commit 8602c34825
3 changed files with 10 additions and 3 deletions

View File

@ -15,14 +15,14 @@
"<all_urls>"
],
"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"

View File

@ -32,6 +32,7 @@
<button style="display: block; margin-left: auto" type="submit">Save</button>
</form>
<script src="vendors.js"></script>
<script src="options.js"></script>
</body>

View File

@ -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',