Created
June 24, 2019 14:33
-
-
Save hamzahamidi/45fa8309dca9156e41312a9fdd311131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// script to enable webpack-bundle-analyzer | |
process.env.NODE_ENV = 'production'; | |
const webpack = require('webpack'); | |
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') | |
.BundleAnalyzerPlugin; | |
const webpackConfigProd = require('react-scripts/config/webpack.config')('production'); | |
webpackConfigProd.plugins.push(new BundleAnalyzerPlugin()); | |
// actually running compilation and waiting for plugin to start explorer | |
webpack(webpackConfigProd, (err, stats) => { | |
if (err || stats.hasErrors()) { | |
console.error(err); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment