From: Eduardo San Martin Morote Date: Tue, 9 Feb 2021 10:27:08 +0000 (+0100) Subject: fix(cjs): ensure dev checks on cjs build X-Git-Tag: v2.0.0-alpha.8~100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a255735211b796120d5f76470ea18759f1eb5d97;p=thirdparty%2Fvuejs%2Fpinia.git fix(cjs): ensure dev checks on cjs build --- diff --git a/rollup.config.js b/rollup.config.js index 9c18b19a..ad9b3af7 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -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