@@ -152,16 +152,16 @@ function createReplacePlugin(
152152 ? // preserve to be handled by bundlers
153153 `(process.env.NODE_ENV !== 'production')`
154154 : // hard coded dev/prod builds
155- ! isProduction ,
155+ JSON . stringify ( ! isProduction ) ,
156156 // this is only used during tests
157- __TEST__ : isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : false ,
157+ __TEST__ : isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : ' false' ,
158158 // If the build is expected to run directly in the browser (global / esm builds)
159- __BROWSER__ : isBrowserBuild ,
159+ __BROWSER__ : JSON . stringify ( isBrowserBuild ) ,
160160 // is targeting bundlers?
161- __BUNDLER__ : isBundlerESMBuild ,
162- __GLOBAL__ : isGlobalBuild ,
161+ __BUNDLER__ : JSON . stringify ( isBundlerESMBuild ) ,
162+ __GLOBAL__ : JSON . stringify ( isGlobalBuild ) ,
163163 // is targeting Node (SSR)?
164- __NODE_JS__ : isNodeBuild ,
164+ __NODE_JS__ : JSON . stringify ( isNodeBuild ) ,
165165 }
166166 // allow inline overrides like
167167 //__RUNTIME_COMPILE__=true yarn build
@@ -170,7 +170,10 @@ function createReplacePlugin(
170170 replacements [ key ] = process . env [ key ]
171171 }
172172 } )
173- return replace ( replacements )
173+ return replace ( {
174+ preventAssignment : true ,
175+ values : replacements ,
176+ } )
174177}
175178
176179function createProductionConfig ( format ) {
0 commit comments