-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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: consider # as a valid dir symbol (fix #4701) #4703
Conversation
It should |
@Shinigami92 Yes, It's the same problem. I also found related PR #2432 but It looks like a different approach to fix the problem. Should I close mine? |
Maybe you could fork #2432, and start from there? The PR is staled, it wasnt merged because of this requested change #2432 (comment) |
@patak-js I'm not sure the fix in #2432 is appropriate. After digging into codes, It seems that simply considering |
Okay, sadly it looks like there are failing tests caused on these PR changes 🙁 |
It looks like there are many edge cases for symbol vite/packages/playground/assets/__tests__/assets.spec.ts Lines 129 to 135 in ff50c22
I think the strategy @patak-js said is indeed a good strategy. I might still need to dig deep for a while. |
Thank you for tackling this issue |
Does it mean
Also, consider this:
Assume we have to check from the right side, wow...
Here we must make sure that trailing slash is necessary for referencing From the left side, it is obviously wrong, take
|
I assume yes, but could be wrong |
Kind of busy these days :(, I will look deeper this weekend. |
It's harder than I think :(. I'm not sure there is a way to pre-determine whether I found the reason tests fail is because of processing CSS files. vite/packages/playground/assets/css/icons.css Lines 12 to 21 in ff50c22
Simply considering # as a valid dir symbol will make vite could not find the correct SVG file imported from css, but <img /> is ok 🤔.vite/packages/playground/assets/index.html Lines 85 to 89 in ff50c22
|
Is there any update? |
The solution is an implementation of #2432 (comment). It should work, I just need to refactor it for better maintenance, then it should be ok to be reviewed. |
@@ -10,7 +10,8 @@ export function loadFallbackPlugin(): Plugin { | |||
name: 'vite:load-fallback', | |||
async load(id) { | |||
try { | |||
return fs.readFile(cleanUrl(id), 'utf-8') | |||
// if we don't add `await` here, we couldn't catch the error in readFile |
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.
So, is this plugin never working 🤣 ?
@Shinigami92 @patak-js Hi, the code should be ok to fix the issue. Sorry for pending so long. |
Let's merge this one once we kick the beta for 2.7 so we get some extra testing |
For reference, this only solves part of the issues with |
fix #4701.
Description
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).