const replacements = {
__COMMIT__: `"${process.env.COMMIT}"`,
__VERSION__: `"${pkg.version}"`,
- __DEV__: isBundlerESMBuild
- ? // preserve to be handled by bundlers
- `(process.env.NODE_ENV !== 'production')`
- : // hard coded dev/prod builds
- !isProduction,
+ __DEV__:
+ isBundlerESMBuild || (isNodeBuild && !isProduction)
+ ? // preserve to be handled by bundlers
+ `(process.env.NODE_ENV !== 'production')`
+ : // hard coded dev/prod builds
+ JSON.stringify(!isProduction),
// this is only used during tests
- __TEST__: isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : false,
+ __TEST__: isBundlerESMBuild ? `(process.env.NODE_ENV === 'test')` : 'false',
// If the build is expected to run directly in the browser (global / esm builds)
- __BROWSER__: isBrowserBuild,
+ __BROWSER__: JSON.stringify(isBrowserBuild),
// is targeting bundlers?
- __BUNDLER__: isBundlerESMBuild,
- __GLOBAL__: isGlobalBuild,
+ __BUNDLER__: JSON.stringify(isBundlerESMBuild),
+ __GLOBAL__: JSON.stringify(isGlobalBuild),
// is targeting Node (SSR)?
- __NODE_JS__: isNodeBuild,
+ __NODE_JS__: JSON.stringify(isNodeBuild),
}
// allow inline overrides like
//__RUNTIME_COMPILE__=true yarn build