Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Bundle size stats doc gen #3094

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const StatsPlugin = require('stats-webpack-plugin');
const through = require('through2');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const webpackStream = require('webpack-stream');
const Visualizer = require('webpack-visualizer-plugin');
const argv = require('yargs').argv;

const paths = {
dist: 'dist',
Expand Down Expand Up @@ -115,7 +117,12 @@ const buildDist = opts => {
new StatsPlugin(`../meta/bundle-size-stats/${opts.output}.json`, {
chunkModules: true,
}),
],
argv.stats
? new Visualizer({
filename: './meta/bundle-size-stats/statistics.html',
})
: 0,
].filter(x => !!x),
};
if (!opts.debug) {
webpackOpts.plugins.push(new UglifyJsPlugin());
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"prepublish": "npm run build",
"pretest": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
"build": "gulp",
"build --stats": "gulp --stats",
"dev": "gulp dev",
"postbuild": "node node_modules/fbjs-scripts/node/check-lib-requires.js lib",
"lint": "eslint .",
Expand All @@ -37,7 +38,8 @@
"dependencies": {
"fbjs": "^2.0.0",
"immutable": "~3.7.4",
"object-assign": "^4.1.1"
"object-assign": "^4.1.1",
"webpack-visualizer-plugin": "^0.1.11"
},
"peerDependencies": {
"react": ">=0.14.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/module-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module.exports = Object.assign(
{
immutable: 'immutable',
React: 'react',
react: 'react',
ReactDOM: 'react-dom',
ReactDOMComet: 'react-dom',
'object-assign': 'object-assign',
Expand Down
Loading