-
-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Description
Ejecting is a real shame for any instance of create-react-app, so I found a way to use webpack-bundle-analyzer without ejecting. Hopefully this will save someone out there from having to eject to make this addition.
- Create a file in root, I call mine "build.js"
- Add this javascript.
process.env.NODE_ENV = "production"
var 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")node build.js
ManAnRuck, samuelcolvin, connorbrathwaite, juanpasolano, rashidul0405 and 76 moremifi, bartekczyz, MakChan, OleTurvoll, revathweinvest and 3 moreMartinsos, hisapy, bartekczyz, MakChan, shanvl and 1 more
Metadata
Metadata
Assignees
Labels
No labels
