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:
@@ -42,41 +42,44 @@ module.exports = merge(common, {
|
||||
|
||||
optimization: {
|
||||
removeAvailableModules: false,
|
||||
runtimeChunk: false,
|
||||
removeEmptyChunks: false,
|
||||
splitChunks: false,
|
||||
splitChunks: false
|
||||
},
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
rules: [{
|
||||
test: /\.tsx?$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
cacheDirectory: true,
|
||||
babelrc: false,
|
||||
plugins: [
|
||||
[require('@rtsao/plugin-proposal-class-properties'), { loose: true }],
|
||||
'angularjs-annotate',
|
||||
'@babel/plugin-syntax-dynamic-import', // needed for `() => import()` in routes.ts
|
||||
'react-hot-loader/babel',
|
||||
],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: { browsers: 'last 3 versions' },
|
||||
useBuiltIns: 'entry',
|
||||
use: [{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
cacheDirectory: true,
|
||||
babelrc: false,
|
||||
plugins: [
|
||||
[require('@rtsao/plugin-proposal-class-properties'), {
|
||||
loose: true
|
||||
}],
|
||||
'angularjs-annotate',
|
||||
'@babel/plugin-syntax-dynamic-import', // needed for `() => import()` in routes.ts
|
||||
'react-hot-loader/babel',
|
||||
],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
browsers: 'last 3 versions'
|
||||
},
|
||||
],
|
||||
'@babel/preset-typescript',
|
||||
'@babel/preset-react',
|
||||
useBuiltIns: 'entry',
|
||||
modules: false
|
||||
},
|
||||
],
|
||||
},
|
||||
'@babel/preset-typescript',
|
||||
'@babel/preset-react',
|
||||
],
|
||||
},
|
||||
],
|
||||
}, ],
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
@@ -86,7 +89,9 @@ module.exports = merge(common, {
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
config: { path: __dirname + '/postcss.config.js' },
|
||||
config: {
|
||||
path: __dirname + '/postcss.config.js'
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -108,6 +113,7 @@ module.exports = merge(common, {
|
||||
template: path.resolve(__dirname, '../../public/views/index-template.html'),
|
||||
inject: 'body',
|
||||
alwaysWriteToDisk: true,
|
||||
chunksSortMode: 'none'
|
||||
}),
|
||||
new HtmlWebpackHarddiskPlugin(),
|
||||
new webpack.NamedModulesPlugin(),
|
||||
|
||||
Reference in New Issue
Block a user