Skip to content

Commit

Permalink
fix: no supportfile + no specs, vite don't crash
Browse files Browse the repository at this point in the history
When there is no values, in the optimization array,
supportFile can be a boolean. the final optimized entry passed to
fast-glog is then `[false]` whic crashes cypress.

This protects against the no-spec issue

closes #17373
  • Loading branch information
elevatebart committed Aug 5, 2021
1 parent bc4df1e commit 8721767
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion npm/vite-dev-server/src/startServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const resolveServerConfig = async ({ viteConfig, options }: StartDevServerOption
// Ask vite to pre-optimize all dependencies of the specs
finalConfig.optimizeDeps = finalConfig.optimizeDeps || {}

finalConfig.optimizeDeps.entries = [...options.specs.map((spec) => spec.relative), supportFile]
if (options.specs.length || supportFile) {
finalConfig.optimizeDeps.entries = [...options.specs.map((spec) => spec.relative), supportFile]
}

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

Expand Down

0 comments on commit 8721767

Please sign in to comment.