@@ -147,42 +147,44 @@ function applyNxIndependentConfig(
147
147
...( config . ignoreWarnings ?? [ ] ) ,
148
148
] ;
149
149
150
- config . optimization = ! isProd
151
- ? undefined
152
- : {
153
- ...( config . optimization ?? { } ) ,
154
- sideEffects : true ,
155
- minimize :
156
- typeof options . optimization === 'object'
157
- ? ! ! options . optimization . scripts
158
- : ! ! options . optimization ,
159
- minimizer : [
160
- new SwcJsMinimizerRspackPlugin ( {
161
- extractComments : false ,
162
- minimizerOptions : {
163
- // this needs to be false to allow toplevel variables to be used in the global scope
164
- // important especially for module-federation which operates as such
165
- module : false ,
166
- mangle : {
167
- keep_classnames : true ,
150
+ config . optimization = {
151
+ ...( config . optimization ?? { } ) ,
152
+ ...( isProd
153
+ ? {
154
+ sideEffects : true ,
155
+ minimize :
156
+ typeof options . optimization === 'object'
157
+ ? ! ! options . optimization . scripts
158
+ : ! ! options . optimization ,
159
+ minimizer : [
160
+ new SwcJsMinimizerRspackPlugin ( {
161
+ extractComments : false ,
162
+ minimizerOptions : {
163
+ // this needs to be false to allow toplevel variables to be used in the global scope
164
+ // important especially for module-federation which operates as such
165
+ module : false ,
166
+ mangle : {
167
+ keep_classnames : true ,
168
+ } ,
169
+ format : {
170
+ ecma : getTerserEcmaVersion (
171
+ path . join ( options . root , options . projectRoot )
172
+ ) ,
173
+ ascii_only : true ,
174
+ comments : false ,
175
+ webkit : true ,
176
+ safari10 : true ,
177
+ } ,
168
178
} ,
169
- format : {
170
- ecma : getTerserEcmaVersion (
171
- path . join ( options . root , options . projectRoot )
172
- ) ,
173
- ascii_only : true ,
174
- comments : false ,
175
- webkit : true ,
176
- safari10 : true ,
177
- } ,
178
- } ,
179
- } ) ,
180
- ] ,
181
- concatenateModules : true ,
182
- runtimeChunk : isDevServer
183
- ? config . optimization ?. runtimeChunk ?? undefined
184
- : false ,
185
- } ;
179
+ } ) ,
180
+ ] ,
181
+ concatenateModules : true ,
182
+ runtimeChunk : isDevServer
183
+ ? config . optimization ?. runtimeChunk ?? undefined
184
+ : false ,
185
+ }
186
+ : { } ) ,
187
+ } ;
186
188
187
189
config . stats = {
188
190
hash : true ,
0 commit comments