File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -90,14 +90,22 @@ function webpackOverride (config) {
90
90
new webpack . ProvidePlugin ( {
91
91
process : 'process/browser' ,
92
92
Buffer : [ 'buffer' , 'Buffer' ]
93
- } ) ,
94
- new BundleAnalyzerPlugin ( {
95
- generateStatsFile : true ,
96
- analyzerMode : 'disabled' ,
97
- openAnalyzer : false
98
93
} )
99
94
] )
100
95
96
+ /**
97
+ * NODE_ENV is overridden by react-scripts/react-app-rewired-esm,
98
+ * so we set BUILD_ENV in the analyze script
99
+ */
100
+ if ( process . env . BUILD_ENV === 'analyze' ) {
101
+ config . plugins . push (
102
+ new BundleAnalyzerPlugin ( {
103
+ analyzerMode : 'server' ,
104
+ openAnalyzer : true
105
+ } )
106
+ )
107
+ }
108
+
101
109
config . module . rules = modifyBabelLoaderRuleForBuild ( config . module . rules )
102
110
config . module . rules . push ( {
103
111
test : / \. j s x ? $ / ,
Original file line number Diff line number Diff line change 29
29
"test:e2e" : " cross-env REACT_APP_ENV=test npx playwright test -c ./test/e2e" ,
30
30
"test:build" : " cross-env REACT_APP_ENV=test run-s build" ,
31
31
"test:coverage" : " jest --coverage" ,
32
- "analyze" : " webpack-bundle-analyzer build/stats.json " ,
32
+ "analyze" : " cross-env BUILD_ENV=analyze npm run build" ,
33
33
"eject" : " react-scripts eject" ,
34
34
"storybook" : " start-storybook -p 9009" ,
35
35
"build-storybook" : " build-storybook --modern" ,
You can’t perform that action at this time.
0 commit comments