From 16d11f41ce90bbef12540eaf0f052ea0a725d3be Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 16 Feb 2021 11:22:55 -0800 Subject: [PATCH] Split bundle --- packages/webapp/webpack.common.js | 13 +++++-------- packages/webapp/webpack.prod.js | 14 ++------------ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/packages/webapp/webpack.common.js b/packages/webapp/webpack.common.js index f5f773d6..4cfa9d02 100644 --- a/packages/webapp/webpack.common.js +++ b/packages/webapp/webpack.common.js @@ -1,8 +1,6 @@ const path = require('path'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); -const CompressionPlugin = require('compression-webpack-plugin'); - module.exports = { entry: { @@ -38,14 +36,13 @@ module.exports = { splitChunks: { cacheGroups: { vendors: { - test: /node_modules\/(?!antd\/).*/, + test: /node_modules\/(?!@material-ui\/).*/, name: "vendors", chunks: "all", }, - // This can be your own design library. - antd: { - test: /node_modules\/(antd\/).*/, - name: "antd", + material: { + test: /node_modules\/(@material-ui\/).*/, + name: "material-ui", chunks: "all", }, }, @@ -64,5 +61,5 @@ module.exports = { } }] }) - ] + ] } \ No newline at end of file diff --git a/packages/webapp/webpack.prod.js b/packages/webapp/webpack.prod.js index 94121e26..8efe8108 100644 --- a/packages/webapp/webpack.prod.js +++ b/packages/webapp/webpack.prod.js @@ -2,6 +2,8 @@ const { merge } = require('webpack-merge'); const common = require('./webpack.common.js'); const path = require('path'); +const CompressionPlugin = require('compression-webpack-plugin'); + module.exports = merge(common, { mode: 'production', devtool: 'source-map', @@ -9,18 +11,6 @@ module.exports = merge(common, { minimize: true }, plugins: [ - new CleanWebpackPlugin(), - new CopyWebpackPlugin({ - patterns: [{ - from: 'public/*', - to: '[name].[ext]', - globOptions: { - ignore: [ - '**/index.html' - ] - } - }] - }), new CompressionPlugin() ] });