Skip to content

Commit 1d6f462

Browse files
authored
fix cssNavigation: detect scheme‑prefixed import paths with regex
1 parent 2e618be commit 1d6f462

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/services/cssNavigation.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,11 @@ export class CSSNavigation {
423423
}
424424

425425
// Treat bare module names (“bootstrap/...”) like sass-loader does
426-
const isBareImport = !target.startsWith('.') // not ./ or ../
427-
&& !target.startsWith('/') // not workspace-absolute
428-
&& target.indexOf(':') === -1; // not a scheme (file://)
426+
const startsWithSchemeRegex = /^\w[\w\d+.-]:/;
427+
428+
const isBareImport = !target.startsWith('.') // not ./ or ../
429+
&& !target.startsWith('/') // not workspace-absolute
430+
&& !startsWithSchemeRegex.test(target); // not a scheme (file://, http://, etc.)
429431

430432
if (isBareImport) {
431433
const moduleRef = await this.mapReference(

0 commit comments

Comments
 (0)