Skip to content

Commit

Permalink
Use optimization.splitChunks & optimization.runtimeChunks to split ve…
Browse files Browse the repository at this point in the history
…ndor, webpack runtime, and user code chunks
  • Loading branch information
Hypnosphi committed Mar 9, 2018
1 parent 7c1ec3a commit ea61da5
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/angular/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ export default function(configDir) {
performance: {
hints: false,
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down
10 changes: 10 additions & 0 deletions app/angular/src/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ export default function(configDir) {
// Based on this CRA feature: https://github.com/facebookincubator/create-react-app/issues/253
modules: ['node_modules'].concat(nodePaths),
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down
10 changes: 10 additions & 0 deletions app/polymer/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ export default function(configDir) {
performance: {
hints: false,
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down
10 changes: 10 additions & 0 deletions app/polymer/src/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ export default function(configDir) {
// Based on this CRA feature: https://github.com/facebookincubator/create-react-app/issues/253
modules: ['node_modules'].concat(nodePaths),
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down
10 changes: 10 additions & 0 deletions app/react-native/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ const getConfig = options => ({
},
],
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
});

export default getConfig;
10 changes: 10 additions & 0 deletions app/react-native/src/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ const getConfig = options => {
},
],
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down
10 changes: 10 additions & 0 deletions app/react/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ export default function(configDir) {
performance: {
hints: false,
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down
10 changes: 10 additions & 0 deletions app/react/src/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ export default function(configDir) {
// Based on this CRA feature: https://github.com/facebookincubator/create-react-app/issues/253
modules: ['node_modules'].concat(nodePaths),
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down
10 changes: 10 additions & 0 deletions app/vue/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ export default function(configDir) {
performance: {
hints: false,
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down
10 changes: 10 additions & 0 deletions app/vue/src/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ export default function(configDir) {
vue$: require.resolve('vue/dist/vue.esm.js'),
},
},
optimization: {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
splitChunks: {
chunks: 'all',
},
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
},
};

return config;
Expand Down

0 comments on commit ea61da5

Please sign in to comment.