1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Add splitChunks plugin and its configs

Signed-off-by: Hung-Han (Henry) Chen <1474479+chenhunghan@users.noreply.github.com>
This commit is contained in:
Hung-Han (Henry) Chen 2020-12-14 14:24:46 +08:00
parent 8dfe991adc
commit bcfa00aea5
No known key found for this signature in database
GPG Key ID: A28B7834EFA73792
2 changed files with 18 additions and 0 deletions

View File

@ -36,6 +36,15 @@ export default function (): webpack.Configuration {
externals: nodeExternals(),
optimization: {
minimize: isProduction,
// Automatically split vendor and commons in development
// (for faster re-compiling)
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
splitChunks: isDevelopment ? {
chunks: "all",
} : false,
runtimeChunk: isDevelopment ? {
name: (entrypoint: { name: string }) => `runtime-${entrypoint.name}`,
} : false,
},
module: {
rules: [

View File

@ -79,6 +79,15 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
}
})
],
// Automatically split vendor and commons in development
// (for faster re-compiling)
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
splitChunks: isDevelopment ? {
chunks: "all",
}: false,
runtimeChunk: isDevelopment ? {
name: (entrypoint: { name: string }) => `runtime-${entrypoint.name}`,
}: false,
},
module: {