Skip to content

Commit

Permalink
fix: await scanner (#11242)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 7, 2022
1 parent 8043fe4 commit 52a6732
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion packages/vite/src/node/optimizer/optimizer.ts
Expand Up @@ -161,10 +161,16 @@ async function createDepsOptimizer(
let firstRunCalled = !!cachedMetadata

let postScanOptimizationResult: Promise<DepOptimizationResult> | undefined
let discoverProjectDependenciesPromise:
| Promise<Record<string, string>>
| undefined

let optimizingNewDeps: Promise<DepOptimizationResult> | undefined
async function close() {
closed = true
await discoverProjectDependenciesPromise?.catch(() => {
/* ignore error for scanner because it's not important */
})
await postScanOptimizationResult
await optimizingNewDeps
}
Expand Down Expand Up @@ -202,7 +208,9 @@ async function createDepsOptimizer(
try {
debug(colors.green(`scanning for dependencies...`))

const deps = await discoverProjectDependencies(config)
discoverProjectDependenciesPromise =
discoverProjectDependencies(config)
const deps = await discoverProjectDependenciesPromise

debug(
colors.green(
Expand Down
@@ -1,7 +1,7 @@
import { expect, test } from 'vitest'
import { getColor, page, untilUpdated } from '~utils'

test.skip('should have css applied on second dynamic import', async () => {
test('should have css applied on second dynamic import', async () => {
await untilUpdated(() => page.textContent('.content'), 'Initial', true)
await page.click('.b')

Expand Down

0 comments on commit 52a6732

Please sign in to comment.