Skip to content

Commit

Permalink
fix: conditionally require vue and update alias if installed
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiller1990 committed Apr 15, 2021
1 parent 7ccd4ac commit a751e07
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions npm/vite-dev-server/src/startServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ const resolveServerConfig = async ({ viteConfig, options }: StartDevServer): Pro
// only cjs compiler-core accepts using prefixIdentifiers in slots which vue test utils use.
// Could we resolve this usage in test-utils?
finalConfig.resolve = finalConfig.resolve || {}
finalConfig.resolve.alias = {
...finalConfig.resolve.alias,
'@vue/compiler-core': resolve(dirname(require.resolve('@vue/compiler-core')), 'dist', 'compiler-core.cjs.js'),
},
try {
finalConfig.resolve.alias = {
...finalConfig.resolve.alias,
'@vue/compiler-core': resolve(dirname(require.resolve('@vue/compiler-core')), 'dist', 'compiler-core.cjs.js'),
}
} catch (e) {
// Vue 3 is not installed
}

finalConfig.server = finalConfig.server || {}

Expand Down

0 comments on commit a751e07

Please sign in to comment.