]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
build: add deprecated vue-router.esm-bundler export
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 15 Oct 2025 08:25:35 +0000 (10:25 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 15 Oct 2025 08:25:35 +0000 (10:25 +0200)
Close #2569

packages/router/tsdown.config.ts

index 99d4ddf907905cef26df5a08dc7f88dc1b848066..ba9641556fdfde4159a13391ae7740c404cc645c 100644 (file)
@@ -1,5 +1,10 @@
 import { type Options } from 'tsdown'
 import pkg from './package.json' with { type: 'json' }
+import fs from 'node:fs/promises'
+import { dirname, resolve } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const __dirname = dirname(fileURLToPath(import.meta.url))
 
 const banner = `
 /*!
@@ -34,6 +39,17 @@ const commonOptions = {
     __FEATURE_PROD_DEVTOOLS__: `__VUE_PROD_DEVTOOLS__`,
   },
   dts: false,
+  // TODO: remove in v5
+  async onSuccess() {
+    // write a stub file for vue-router.esm-bundler.js
+    await fs.writeFile(
+      resolve(__dirname, 'dist/vue-router.esm-bundler.js'),
+      `
+console.warn("[vue-router]: importing from 'vue-router/dist/vue-router.esm-bundler.js' is deprecated. Use 'vue-router' directly.")
+export * from './vue-router.mjs'
+`.trimStart()
+    )
+  },
 } satisfies Options
 
 const esm = {