Skip to content

Commit

Permalink
fix: ensure the same vue dep in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 1, 2021
1 parent 055e3fd commit d6b8568
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions src/node/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,18 @@ export function resolveAliases(
{
find: /^vitepress$/,
replacement: path.join(__dirname, '../client/index')
},
// alias for local linked development
{ find: /^vitepress\//, replacement: PKG_ROOT + '/' },
// make sure it always use the same vue dependency that comes with
// vitepress itself
{
find: /^vue$/,
replacement: require.resolve(
'@vue/runtime-dom/dist/runtime-dom.esm-bundler.js'
)
}
]

let isLinked = false
try {
require.resolve('vitepress', { paths: [root] })
} catch (e) {
isLinked = true
}

if (isLinked) {
// aliases for local linked development
aliases.push(
{ find: /^vitepress\//, replacement: PKG_ROOT + '/' },
{
find: /^vue$/,
replacement: require.resolve(
'@vue/runtime-dom/dist/runtime-dom.esm-bundler.js'
)
}
)
}

return aliases
}

0 comments on commit d6b8568

Please sign in to comment.