Skip to content

Commit

Permalink
fix(cjs): ensure dev checks on cjs build
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 9, 2021
1 parent 17b1acb commit a255735
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions rollup.config.js
Expand Up @@ -148,20 +148,21 @@ function createReplacePlugin(
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
Expand Down

0 comments on commit a255735

Please sign in to comment.