Skip to content

Commit

Permalink
fix: when there are specs but the supportFile is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed Aug 9, 2021
1 parent 7f575d3 commit cdb2a52
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions npm/vite-dev-server/src/startServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ const resolveServerConfig = async ({ viteConfig, options }: StartDevServerOption
// Ask vite to pre-optimize all dependencies of the specs
finalConfig.optimizeDeps = finalConfig.optimizeDeps || {}

if ((options.specs && options.specs.length) || supportFile) {
finalConfig.optimizeDeps.entries = [...options.specs.map((spec) => spec.relative), supportFile]
// pre-optimizea all the specs
if ((options.specs && options.specs.length)) {
finalConfig.optimizeDeps.entries = [...options.specs.map((spec) => spec.relative)]
// only optimize a supportFile is it is not false or undefined
if (supportFile) {
finalConfig.optimizeDeps.entries.push(supportFile)
}
}

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

0 comments on commit cdb2a52

Please sign in to comment.