diff --git a/scripts/webpack/webpack.common.js b/scripts/webpack/webpack.common.js index cdc17b5ec00..600e5b480c8 100644 --- a/scripts/webpack/webpack.common.js +++ b/scripts/webpack/webpack.common.js @@ -10,7 +10,7 @@ module.exports = { path: path.resolve(__dirname, '../../public/build'), filename: '[name].[hash].js', // Keep publicPath relative for host.com/grafana/ deployments - publicPath: "public/build/", + publicPath: 'public/build/', }, resolve: { extensions: ['.ts', '.tsx', '.es6', '.js', '.json', '.svg'], @@ -61,6 +61,18 @@ module.exports = { } ] }, + // https://webpack.js.org/plugins/split-chunks-plugin/#split-chunks-example-3 + optimization: { + splitChunks: { + cacheGroups: { + commons: { + test: /[\\/]node_modules[\\/].*[jt]sx?$/, + name: 'vendor', + chunks: 'all' + } + } + } + }, plugins: [ new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true, diff --git a/scripts/webpack/webpack.dev.js b/scripts/webpack/webpack.dev.js index 7e103b32606..c10722b2732 100644 --- a/scripts/webpack/webpack.dev.js +++ b/scripts/webpack/webpack.dev.js @@ -58,25 +58,6 @@ module.exports = merge(common, { ] }, - optimization: { - splitChunks: { - cacheGroups: { - manifest: { - chunks: "initial", - test: "vendor", - name: "vendor", - enforce: true - }, - vendor: { - chunks: "initial", - test: "vendor", - name: "vendor", - enforce: true - } - } - } - }, - plugins: [ new CleanWebpackPlugin('../../public/build', { allowExternal: true }), new MiniCssExtractPlugin({ diff --git a/scripts/webpack/webpack.prod.js b/scripts/webpack/webpack.prod.js index 880b7e08ed2..0a3cf3ba814 100644 --- a/scripts/webpack/webpack.prod.js +++ b/scripts/webpack/webpack.prod.js @@ -47,17 +47,7 @@ module.exports = merge(common, { }) ] }, - optimization: { - splitChunks: { - cacheGroups: { - commons: { - test: /[\\/]node_modules[\\/].*[jt]sx?$/, - name: "vendor", - chunks: "all" - } - } - }, minimizer: [ new UglifyJsPlugin({ cache: true, @@ -67,7 +57,6 @@ module.exports = merge(common, { new OptimizeCSSAssetsPlugin({}) ] }, - plugins: [ new MiniCssExtractPlugin({ filename: "grafana.[name].[hash].css"