-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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: execute classic worker in dev mode #7099
Conversation
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'm not the most familiar with workers, but I'm not sure if we want to introduce a special @vite-ignore
comment here. That would be non-standard and prone to errors, e.g. some tooling strips comments.
For dynamic cases, I think Vite should just ignore it without an error, and preserve the user code as is? 🤔
Edit: Ah looks like @patak-dev suggested something similar at #7019 (comment)
I think user can't to write code compatible classic worker and module worker When I write the test case for dynamic worker. But vite can automatically ignore this worker file, so it only needs warning. |
I don't know why got a error in unit test |
🤕 |
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.
Looks good to me. Let's wait for the 2.9 beta to merge it to get some testing.
@ygj6 would you help reviewing this PR? I modify your method(getEndIndex), in this case it will got a error. /* ) */ )
// comment it will got a single comment index and the so I use the small index to matched. |
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.
LGTM
Description
fix: #4586
fix: #5853
fix: #7019
close: #6973
Additional context
Detect the case where { type: 'module' } is not provided or { type: 'classic' } is passed with a static string and use classic workers. If a dynamic expression appears, we can issue an error. And give
/* @vite-ignore */
out of Vite processing.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).