-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: incorrectly resolving knownJsSrcRE
files from root (fixes #4161)
#8808
Conversation
✅ Deploy Preview for vite-docs-main ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
(preferRelative && /^\w/.test(id)) || | ||
importer?.endsWith('.html') | ||
((preferRelative || importer?.endsWith('.html')) && /^\w/.test(id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was incorrect. If importer is html it was always handled as relative path.
So /foo.svelte
will be resolved to
const basedir = importer ? path.dirname(importer) : process.cwd() // C:\Users\green\workspace
const fsPath = path.resolve(basedir, id) // C:\foo.svelte
const normalizedFsPath = normalizePath(fsPath) // C:/foo.svelte
if ( | ||
isNonDriveRelativeAbsolutePath(id) && | ||
(res = tryFsResolve(id, options)) | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the condition above is fixed, this is still needed.
/foo.svelte
will be handled as C:/foo.svelte
inside tryFsResolve
by fs.statSync
and others.
Description
path.isAbsolute
return true for/something
also on windows.https://nodejs.org/api/path.html#pathisabsolutepath
If the working directory is
C:\Users\green
,/something
meansC:\something
.fixes #4161
refs #8122
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).