Skip to content

Commit a5b5ce8

Browse files
committed
Recover from missing imports in the project locator
1 parent b9ce8c6 commit a5b5ce8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/tailwindcss-language-server/src/css/resolve-css-imports.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,22 @@ const resolver = createResolver({
1111

1212
const resolveImports = postcss([
1313
postcssImport({
14-
resolve: (id, base) => resolveCssFrom(base, id),
14+
resolve(id, base) {
15+
try {
16+
return resolveCssFrom(base, id)
17+
} catch (e) {
18+
// TODO: Need to test this on windows
19+
return `/virtual:missing/${id}`
20+
}
21+
},
22+
23+
load(filepath) {
24+
if (filepath.startsWith('/virtual:missing/')) {
25+
return Promise.resolve('')
26+
}
27+
28+
return fs.readFile(filepath, 'utf-8')
29+
},
1530
}),
1631
fixRelativePaths(),
1732
])

0 commit comments

Comments
 (0)