Skip to content

Commit 5d3cb96

Browse files
authored
fix(build): ship built-in vue-demi to avoid resolution issues (vuejs#3680)
1 parent 05061bd commit 5d3cb96

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

lib/vue-demi.mjs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* vue-demi v0.14.7
3+
* Copyright (c) 2020-present, Anthony Fu
4+
* @license MIT
5+
*/
6+
7+
import * as Vue from 'vue'
8+
9+
var isVue2 = false
10+
var isVue3 = true
11+
var Vue2 = undefined
12+
13+
function install() {}
14+
15+
export function set(target, key, val) {
16+
if (Array.isArray(target)) {
17+
target.length = Math.max(target.length, key)
18+
target.splice(key, 1, val)
19+
return val
20+
}
21+
target[key] = val
22+
return val
23+
}
24+
25+
export function del(target, key) {
26+
if (Array.isArray(target)) {
27+
target.splice(key, 1)
28+
return
29+
}
30+
delete target[key]
31+
}
32+
33+
export * from 'vue'
34+
export { Vue, Vue2, isVue2, isVue3, install }

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"./theme-without-fonts": {
2525
"types": "./theme-without-fonts.d.ts",
2626
"default": "./dist/client/theme-default/without-fonts.js"
27+
},
28+
"./vue-demi": {
29+
"default": "./lib/vue-demi.mjs"
2730
}
2831
},
2932
"bin": {
@@ -36,7 +39,8 @@
3639
"template",
3740
"client.d.ts",
3841
"theme.d.ts",
39-
"theme-without-fonts.d.ts"
42+
"theme-without-fonts.d.ts",
43+
"lib"
4044
],
4145
"repository": {
4246
"type": "git",

src/node/alias.ts

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export function resolveAliases(
4141
{
4242
find: /^vitepress\/theme$/,
4343
replacement: join(DIST_CLIENT_PATH, '/theme-default/index.js')
44+
},
45+
{
46+
find: /^vue-demi$/,
47+
replacement: require.resolve('vitepress/vue-demi')
4448
}
4549
]
4650

0 commit comments

Comments
 (0)