File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
packages/tailwindcss-language-server/src/util Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -56,5 +56,17 @@ export function resolveFrom(from?: string, id?: string): string {
56
56
57
57
let result = resolver . resolveSync ( { } , from , id )
58
58
if ( result === false ) throw Error ( )
59
+
60
+ // The `enhanced-resolve` package supports resolving paths with fragment
61
+ // identifiers. For example, it can resolve `foo/bar#baz` to `foo/bar.js`
62
+ // However, it's also possible that a path contains a `#` character as part
63
+ // of the path itself. For example, `foo#bar` might point to a file named
64
+ // `foo#bar.js`. The resolver distinguishes between these two cases by
65
+ // escaping the `#` character with a NUL byte when it's part of the path.
66
+ //
67
+ // Since the real path doesn't actually contain NUL bytes, we need to remove
68
+ // them to get the correct path otherwise readFileSync will throw an error.
69
+ result = result . replace ( / \0 ( .) / g, '$1' )
70
+
59
71
return result
60
72
}
You can’t perform that action at this time.
0 commit comments