Skip to content

Commit 22ef431

Browse files
Handle undefined in addition to nulls
1 parent 53e53ca commit 22ef431

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

packages/@tailwindcss-vite/src/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ class Root {
373373
let inputPath = idToPath(this.id)
374374
let inputBase = path.dirname(path.resolve(inputPath))
375375

376-
if (this.compiler === null || this.scanner === null || this.rebuildStrategy === 'full') {
376+
if (!this.compiler || !this.scanner || this.rebuildStrategy === 'full') {
377377
this.rebuildStrategy = 'incremental'
378378
clearRequireCache(Array.from(this.dependencies))
379379
this.dependencies = new Set([idToPath(inputPath)])
@@ -417,12 +417,6 @@ class Root {
417417
})
418418
}
419419

420-
if (!this.scanner || !this.compiler) {
421-
// TypeScript does not properly refine the scanner and compiler properties
422-
// (even when extracted into a variable)
423-
throw new Error('Tailwind CSS compiler is not initialized.')
424-
}
425-
426420
// This should not be here, but right now the Vite plugin is setup where we
427421
// setup a new scanner and compiler every time we request the CSS file
428422
// (regardless whether it actually changed or not).

0 commit comments

Comments
 (0)