Created
June 24, 2019 14:32
-
-
Save hamzahamidi/82f2606f708c32dfa0ded08ea05c911a 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.prod'); | |
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