Skip to content

Commit

Permalink
Recover from missing imports in the project locator
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Dec 11, 2024
1 parent b9ce8c6 commit a5b5ce8
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,22 @@ const resolver = createResolver({

const resolveImports = postcss([
postcssImport({
resolve: (id, base) => resolveCssFrom(base, id),
resolve(id, base) {
try {
return resolveCssFrom(base, id)
} catch (e) {
// TODO: Need to test this on windows
return `/virtual:missing/${id}`
}
},

load(filepath) {
if (filepath.startsWith('/virtual:missing/')) {
return Promise.resolve('')
}

return fs.readFile(filepath, 'utf-8')
},
}),
fixRelativePaths(),
])
Expand Down

0 comments on commit a5b5ce8

Please sign in to comment.