@@ -152,16 +152,16 @@ function createReplacePlugin(
152
152
? // preserve to be handled by bundlers
153
153
`(process.env.NODE_ENV !== 'production')`
154
154
: // hard coded dev/prod builds
155
- ! isProduction ,
155
+ JSON . stringify ( ! isProduction ) ,
156
156
// this is only used during tests
157
- __TEST__ : isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : false ,
157
+ __TEST__ : isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : ' false' ,
158
158
// If the build is expected to run directly in the browser (global / esm builds)
159
- __BROWSER__ : isBrowserBuild ,
159
+ __BROWSER__ : JSON . stringify ( isBrowserBuild ) ,
160
160
// is targeting bundlers?
161
- __BUNDLER__ : isBundlerESMBuild ,
162
- __GLOBAL__ : isGlobalBuild ,
161
+ __BUNDLER__ : JSON . stringify ( isBundlerESMBuild ) ,
162
+ __GLOBAL__ : JSON . stringify ( isGlobalBuild ) ,
163
163
// is targeting Node (SSR)?
164
- __NODE_JS__ : isNodeBuild ,
164
+ __NODE_JS__ : JSON . stringify ( isNodeBuild ) ,
165
165
}
166
166
// allow inline overrides like
167
167
//__RUNTIME_COMPILE__=true yarn build
@@ -170,7 +170,10 @@ function createReplacePlugin(
170
170
replacements [ key ] = process . env [ key ]
171
171
}
172
172
} )
173
- return replace ( replacements )
173
+ return replace ( {
174
+ preventAssignment : true ,
175
+ values : replacements ,
176
+ } )
174
177
}
175
178
176
179
function createProductionConfig ( format ) {
0 commit comments