From 3db38fbd0b84d066d64f9b637f1efcc35ebf8ce3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 8 May 2019 01:32:33 +0200 Subject: restore webpack splitting behavior --- webpack.config.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'webpack.config.js') diff --git a/webpack.config.js b/webpack.config.js index f0c2a16ce..68e8b3cac 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ const path = require('path'); const webpack = require('webpack'); const merge = require('webpack-merge'); const { CheckerPlugin } = require('awesome-typescript-loader') +const TerserPlugin = require('terser-webpack-plugin'); function externalsCb(context, request, callback) { @@ -17,7 +18,7 @@ module.exports = function (env) { const base = { output: { filename: '[name]-bundle.js', - chunkFilename: "[id].chunk.js", + chunkFilename: "[id]-bundle.js", path: path.resolve(__dirname, "dist"), }, module: { @@ -43,6 +44,18 @@ module.exports = function (env) { externalsCb, "child_process", ], + optimization: { + minimize: false, + minimizer: [ + new TerserPlugin({ + sourceMap: true, + terserOptions: { + keep_classnames: true, + keep_fnames: true, + } + }), + ], + } } const configWebWorker = { entry: {"cryptoWorker": "./src/crypto/cryptoWorker.ts"}, @@ -81,9 +94,14 @@ module.exports = function (env) { name: "pages", optimization: { splitChunks: { - name: "page-common", - minChunks: 2, - } + cacheGroups: { + commons: { + name: 'page-common', + chunks: 'all', + minChunks: 2, + }, + }, + }, }, }; -- cgit v1.2.3