]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix(cjs): ensure dev checks on cjs build
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 9 Feb 2021 10:27:08 +0000 (11:27 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 9 Feb 2021 10:27:08 +0000 (11:27 +0100)
rollup.config.js

index 9c18b19ae00cd359cf668c5ded3e7c2efc76b9d3..ad9b3af7bc955881e728c943b14fcf8ab81ed023 100644 (file)
@@ -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