Skip to content

Commit d6b8568

Browse files
committed
fix: ensure the same vue dep in all cases
1 parent 055e3fd commit d6b8568

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

src/node/alias.ts

+10-20
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,18 @@ export function resolveAliases(
3737
{
3838
find: /^vitepress$/,
3939
replacement: path.join(__dirname, '../client/index')
40+
},
41+
// alias for local linked development
42+
{ find: /^vitepress\//, replacement: PKG_ROOT + '/' },
43+
// make sure it always use the same vue dependency that comes with
44+
// vitepress itself
45+
{
46+
find: /^vue$/,
47+
replacement: require.resolve(
48+
'@vue/runtime-dom/dist/runtime-dom.esm-bundler.js'
49+
)
4050
}
4151
]
4252

43-
let isLinked = false
44-
try {
45-
require.resolve('vitepress', { paths: [root] })
46-
} catch (e) {
47-
isLinked = true
48-
}
49-
50-
if (isLinked) {
51-
// aliases for local linked development
52-
aliases.push(
53-
{ find: /^vitepress\//, replacement: PKG_ROOT + '/' },
54-
{
55-
find: /^vue$/,
56-
replacement: require.resolve(
57-
'@vue/runtime-dom/dist/runtime-dom.esm-bundler.js'
58-
)
59-
}
60-
)
61-
}
62-
6353
return aliases
6454
}

0 commit comments

Comments
 (0)