Open valscion opened 5 years ago
So I guess once I update react-scripts to 2.0, this is the command to run webpack-bundle-analyzer on a CRA 2.0 app, right?
npm run build -- --stats && webpack-bundle-analyzer build/bundle-stats.json
(That's from the diff where they stripped the docs out of the README for CRA 2.0.)
I have webpack-bundle-analyzer 2.13.1 working with CRA/react-scripts 1.0 using this code
process.env.NODE_ENV = 'production';
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;
const webpackConfigProd = require('react-scripts/config/webpack.config.prod');
webpackConfigProd.plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: 'report.html',
}));
require('react-scripts/scripts/build');
What was the reason the one-line script got stripped from the docs?
-Jason
So I guess once I update react-scripts to 2.0, this is the command to run webpack-bundle-analyzer on a CRA 2.0 app, right?
Yes, that's the way :relaxed:
What was the reason the one-line script got stripped from the docs?
The current UI can be misleading and create-react-app has more strict guidelines on what is acceptable before it can be promoted in the CRA docs.
Also the docs shouldn't have been merged before 2.0 was a thing, as it would've been way too confusing for people reading the README over at CRA GitHub repo.
https://github.com/facebook/create-react-app/issues/4563#issuecomment-425279889
I'm opening this issue here just so we don't forget about this.