Skip to content

Commit

Permalink
fix: analyze deps of the specs before starting
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed Apr 29, 2021
1 parent 66a774c commit 3f52def
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion npm/vite-dev-server/src/startServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const resolveServerConfig = async ({ viteConfig, options }: StartDevServer): Pro
// This alias is necessary to avoid a "prefixIdentifiers" issue from slots mounting
// 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 || {}
try {
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'),
Expand All @@ -56,6 +56,11 @@ const resolveServerConfig = async ({ viteConfig, options }: StartDevServer): Pro

finalConfig.server.port = await getPort({ port: finalConfig.server.port || 3000, host: 'localhost' }),

// Ask vite to pre-optimize all dependencies of the specs
finalConfig.optimizeDeps = finalConfig.optimizeDeps || {}

finalConfig.optimizeDeps.entries = [...options.specs.map((spec) => spec.relative), supportFile]

debug(`the resolved server config is ${JSON.stringify(finalConfig, null, 2)}`)

return finalConfig
Expand Down

0 comments on commit 3f52def

Please sign in to comment.