]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
build: add vue-router.esm-browser.prod.js (#2242)
authorskirtle <65301168+skirtles-code@users.noreply.github.com>
Wed, 13 Nov 2024 11:10:52 +0000 (11:10 +0000)
committerGitHub <noreply@github.com>
Wed, 13 Nov 2024 11:10:52 +0000 (12:10 +0100)
Co-authored-by: kianfang <kianfang@163.com>
Co-authored-by: Kian <16569491+kianfang@users.noreply.github.com>
packages/router/rollup.config.mjs

index d82c47954dfff4d4f992a57435d8215e1c3c404e..fc8aaa3b0c32e211ff1f0317faafddd8e5a92f56 100644 (file)
@@ -59,7 +59,7 @@ const packageConfigs = packageBuilds.map(buildName =>
 packageBuilds.forEach(buildName => {
   if (buildName === 'cjs') {
     packageConfigs.push(createProductionConfig(buildName))
-  } else if (buildName === 'global') {
+  } else if (buildName === 'global' || buildName === 'browser') {
     packageConfigs.push(createMinifiedConfig(buildName))
   }
 })
@@ -125,6 +125,10 @@ function createConfig(buildName, output, plugins = []) {
     // Global and Browser ESM builds inlines everything so that they can be
     // used alone.
     external,
+    treeshake: {
+      // Ensure @vue/devtools-api can be treeshaken in production builds
+      moduleSideEffects: false,
+    },
     plugins: [
       tsPlugin,
       createReplacePlugin(
@@ -224,7 +228,7 @@ function createMinifiedConfig(format) {
   return createConfig(
     format,
     {
-      file: `dist/${name}.${format}.prod.js`,
+      file: outputConfigs[format].file.replace(/.js$/, '.prod.js'),
       format: outputConfigs[format].format,
     },
     [