Skip to content

Commit 7c733dc

Browse files
committed
Add webpack-bundle-analyzer plugin.
1 parent 12cc8ed commit 7c733dc

5 files changed

Lines changed: 94 additions & 4 deletions

File tree

build-tests/localization-plugin-test/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@microsoft/rush-stack-compiler-3.5": "0.4.2",
1414
"ts-loader": "6.0.0",
1515
"webpack": "~4.31.0",
16+
"webpack-bundle-analyzer": "~3.6.0",
1617
"webpack-cli": "~3.3.2",
1718
"webpack-dev-server": "~3.9.0"
1819
}

build-tests/localization-plugin-test/webpack.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require('path');
44
const webpack = require('webpack');
55

66
const { LocalizationPlugin } = require('@rushstack/localization-plugin');
7+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
78

89
module.exports = function(env) {
910
const configuration = {
@@ -15,7 +16,7 @@ module.exports = function(env) {
1516
loader: require.resolve('ts-loader'),
1617
exclude: /(node_modules)/,
1718
options: {
18-
compiler: require.resolve('@microsoft/rush-stack-compiler-3.4/node_modules/typescript'),
19+
compiler: require.resolve('@microsoft/rush-stack-compiler-3.5/node_modules/typescript'),
1920
logLevel: 'ERROR',
2021
configFile: path.resolve(__dirname, 'tsconfig.json')
2122
}
@@ -73,6 +74,14 @@ module.exports = function(env) {
7374
serveLocale: {
7475
locale: 'en-us'
7576
}
77+
}),
78+
new BundleAnalyzerPlugin({
79+
openAnalyzer: false,
80+
analyzerMode: 'static',
81+
reportFilename: path.join(__dirname, 'temp', 'stats.html'),
82+
generateStatsFile: true,
83+
statsFilename: path.join(__dirname, 'temp', 'stats.json'),
84+
logLevel: 'error'
7685
})
7786
]
7887
};

common/config/rush/nonbrowser-approved-packages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,10 @@
598598
"name": "webpack-cli",
599599
"allowedCategories": [ "tests" ]
600600
},
601+
{
602+
"name": "webpack-bundle-analyzer",
603+
"allowedCategories": [ "tests" ]
604+
},
601605
{
602606
"name": "wordwrap",
603607
"allowedCategories": [ "libraries" ]

common/config/rush/pnpm-lock.yaml

Lines changed: 77 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack/localization-plugin/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
"devDependencies": {
3131
"@types/webpack": "4.39.8",
3232
"@microsoft/rush-stack-compiler-3.5": "0.4.2",
33-
"gulp": "~4.0.2",
3433
"@microsoft/node-library-build": "6.4.3",
3534
"@types/glob": "7.1.1",
3635
"@types/loader-utils": "1.1.3",
3736
"@types/jju": "1.4.1",
38-
"@types/lodash": "4.14.116"
37+
"@types/lodash": "4.14.116",
38+
"gulp": "~4.0.2"
3939
}
4040
}

0 commit comments

Comments
 (0)