]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix(build): raw esm for dev only
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 27 Jul 2022 07:43:54 +0000 (09:43 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 27 Jul 2022 07:43:54 +0000 (09:43 +0200)
Fix #1485

rollup.config.js

index 24c2b43ea9e07195610a42a504f24f0428470c6d..557f64995b9686be92c1d0c5781359b5256dfccc 100644 (file)
@@ -136,7 +136,7 @@ function createConfig(buildName, output, plugins = []) {
         isProductionBuild,
         isBundlerESMBuild,
         // isBrowserBuild?
-        isGlobalBuild || isRawESMBuild || isBundlerESMBuild,
+        isRawESMBuild,
         isGlobalBuild,
         isNodeBuild
       ),
@@ -155,7 +155,7 @@ function createConfig(buildName, output, plugins = []) {
 function createReplacePlugin(
   isProduction,
   isBundlerESMBuild,
-  isBrowserBuild,
+  isRawESMBuild,
   isGlobalBuild,
   isNodeBuild
 ) {
@@ -163,18 +163,18 @@ function createReplacePlugin(
     __COMMIT__: `"${process.env.COMMIT}"`,
     __VERSION__: `"${pkg.version}"`,
     __DEV__:
-      isBundlerESMBuild || (isNodeBuild && !isProduction)
+      (isBundlerESMBuild && !isRawESMBuild) || (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 || isNodeBuild
+      (isBundlerESMBuild && !isRawESMBuild) || isNodeBuild
         ? `(process.env.NODE_ENV === 'test')`
         : 'false',
     // If the build is expected to run directly in the browser (global / esm builds)
-    __BROWSER__: JSON.stringify(isBrowserBuild),
+    __BROWSER__: JSON.stringify(isRawESMBuild),
     // is targeting bundlers?
     __BUNDLER__: JSON.stringify(isBundlerESMBuild),
     __GLOBAL__: JSON.stringify(isGlobalBuild),