Performance/Webpack: Introduces more aggressive code-splitting and other perf improvements (#18544)

* Performance/Webpack: Introduces more aggressive code-splitting and other perf improvements
- Introduces dynamic imports for built-in plugins
- Uses dynamic imports for various packages (rst2html, brace)
- Introduces route-based dynamic imports
- Splits angular and moment into separate bundles
This commit is contained in:
kay delaney
2019-09-03 09:29:02 +01:00
committed by GitHub
parent 409874b35d
commit 7985aa1e57
34 changed files with 289 additions and 200 deletions

View File

@@ -20,8 +20,7 @@ module.exports = merge(common, {
},
module: {
rules: [
{
rules: [{
test: /\.tsx?$/,
enforce: 'pre',
exclude: /node_modules/,
@@ -44,11 +43,13 @@ module.exports = merge(common, {
},
},
require('./sass.rule.js')({
sourceMap: false, preserveUrl: false
sourceMap: false,
preserveUrl: false
})
]
},
optimization: {
nodeEnv: 'production',
minimizer: [
new TerserPlugin({
cache: false,
@@ -70,12 +71,15 @@ module.exports = merge(common, {
filename: path.resolve(__dirname, '../../public/views/error.html'),
template: path.resolve(__dirname, '../../public/views/error-template.html'),
inject: false,
excludeChunks: ['dark', 'light'],
chunksSortMode: 'none'
}),
new HtmlWebpackPlugin({
filename: path.resolve(__dirname, '../../public/views/index.html'),
template: path.resolve(__dirname, '../../public/views/index-template.html'),
inject: 'body',
chunks: ['vendor', 'app'],
excludeChunks: ['manifest', 'dark', 'light'],
chunksSortMode: 'none'
}),
function () {
this.hooks.done.tap('Done', function (stats) {