Skip to content

Commit 6fafb88

Browse files
committed
refactor(vendor): use bundle analyzer plugin instead of stats to generate docs
1 parent d471462 commit 6fafb88

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

packages/vendor/bundle/webpack.config.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const path = require('path');
22
const CompressionWebpackPlugin = require('compression-webpack-plugin');
33
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
44
const { StatsWriterPlugin } = require('webpack-stats-plugin');
5+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
56
const { modules } = require('@theforeman/vendor-core');
67

78
const { version } = require('../package.json');
@@ -94,12 +95,10 @@ const config = {
9495
}),
9596
new WebpackExportForemanVendorPlugin({ modules }),
9697
new CompressionWebpackPlugin(),
97-
new StatsWriterPlugin({
98-
filename: `stats.${webpackMode}.json`,
99-
fields: null,
100-
stats: {
101-
all: true,
102-
},
98+
new BundleAnalyzerPlugin({
99+
analyzerMode: 'static',
100+
reportFilename: `../docs/stats.${webpackMode}.html`,
101+
openAnalyzer: false,
103102
}),
104103
],
105104
};

packages/vendor/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,15 @@
2222
],
2323
"scripts": {
2424
"prebuild": "rimraf dist docs",
25-
"postbuild": "rimraf dist/stats.development.json dist/stats.production.json",
2625
"build": "npm run build:bundle && npm run build:plugin && npm run build:scss && npm run build:docs",
2726
"build:bundle": "npm run build:bundle:dev && npm run build:bundle:prod",
2827
"build:bundle:base": "node --max_old_space_size=8192 ./node_modules/.bin/webpack --config bundle/webpack.config.js",
2928
"build:bundle:dev": "npm run build:bundle:base -- --mode=development",
3029
"build:bundle:prod": "npm run build:bundle:base -- --mode=production",
3130
"build:plugin": "webpack --config vendor-webpack-plugin/webpack.config.js",
3231
"build:scss": "./scripts/build-scss.sh",
33-
"build:docs": "npm run build:docs:analyze && npm run build:docs:scss",
32+
"build:docs": "npm run build:docs:scss",
3433
"build:docs:scss": "./scripts/build-scss-docs.sh",
35-
"build:docs:analyze": "npm run build:docs:analyze:dev && npm run build:docs:analyze:prod",
36-
"build:docs:analyze:dev": "webpack-bundle-analyzer --mode static -r docs/stats.development.html dist/stats.development.json",
37-
"build:docs:analyze:prod": "webpack-bundle-analyzer --mode static -r docs/stats.production.html dist/stats.production.json",
3834
"deploy:docs": "./scripts/deploy-docs.sh",
3935
"postpublish": "npm run deploy:docs"
4036
},

0 commit comments

Comments
 (0)