Skip to content

Commit 9b22edc

Browse files
committed
build: add deprecated vue-router.esm-bundler export
Close #2569
1 parent d9c6cc7 commit 9b22edc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/router/tsdown.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { type Options } from 'tsdown'
22
import pkg from './package.json' with { type: 'json' }
3+
import fs from 'node:fs/promises'
4+
import { dirname, resolve } from 'node:path'
5+
import { fileURLToPath } from 'node:url'
6+
7+
const __dirname = dirname(fileURLToPath(import.meta.url))
38

49
const banner = `
510
/*!
@@ -34,6 +39,17 @@ const commonOptions = {
3439
__FEATURE_PROD_DEVTOOLS__: `__VUE_PROD_DEVTOOLS__`,
3540
},
3641
dts: false,
42+
// TODO: remove in v5
43+
async onSuccess() {
44+
// write a stub file for vue-router.esm-bundler.js
45+
await fs.writeFile(
46+
resolve(__dirname, 'dist/vue-router.esm-bundler.js'),
47+
`
48+
console.warn("[vue-router]: importing from 'vue-router/dist/vue-router.esm-bundler.js' is deprecated. Use 'vue-router' directly.")
49+
export * from './vue-router.mjs'
50+
`.trimStart()
51+
)
52+
},
3753
} satisfies Options
3854

3955
const esm = {

0 commit comments

Comments
 (0)