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
feat(worker): Add sourcemap support for worker bundles #5417
Conversation
- Supports true, "inline", and "hidden" for config.build.sourcemap options. - Supports inline and non-inline workers
Co-authored-by: Shinigami <chrissi92@hotmail.de>
@Shinigami92 It looks like this is working but might be waiting on mac/windows servers to run? And has been for a really long time. What would this take to get moving forward? == EDIT == To be clear, I mean this as "Is this a CI server resourcing issue? Or just someone needing to click a button?" Not as "it's your responsibility" |
You need to update the branch with the newest main |
@Shinigami92 Should I do that? |
Would be nice :) |
@KallynGowdy I just checked: rebase and merge both happen without incident! |
uwu 🙁 seems there is an issue with windows?! |
Mh I will let rerun the tests, could be an issue in CI not your fault 🤔 |
@Shinigami92 Is there any update on this? |
hi @KallynGowdy. Are you interested in continuing working on it? if not I can fork the PR and let it forward. ❤️ |
@poyoho Yes, I can update it. Thanks for the offer though! |
I think you can try to think about my unit test writing method 😊, And add the nested worker maybe had a micro error. |
…cemaps # Conflicts: # packages/vite/src/node/plugins/worker.ts # packages/vite/src/node/plugins/workerImportMetaUrl.ts
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.
look good to me. great work here!
Looks like another flaky test run... |
There should be no problem. I often encounter this situation 🙆♂️ |
…cemaps # Conflicts: # packages/vite/src/node/plugins/worker.ts # packages/vite/src/node/plugins/workerImportMetaUrl.ts
Awesome work @KallynGowdy, let's get this one in 2.9! |
Description
Improves the built-in worker plugin to support emitting sourcemaps for generated worker bundles. Closes #5395.
Tests have been added to validate that sourcemaps are generated for inline, non-inline, and shared workers.
Additional context
3 additonal test packages have been added:
sourcemap
sourcemap-hidden
sourcemap-inline
Each of these packages are copied from the
worker
test package and adds avite.config.ts
to enable sourcemaps for the respective test case (true
,hidden
, andinline
). The actual test code validates that the.js.map
files are created and additionally that the source files link to them using a//# sourceMappingURL=
comment.One tricky edge case is the scenario where non-inline sourcemaps are being used with inline workers. In this case, the embedded comment has to use the full path (basepath + fileName) instead of simply using the file name. The tests don't address this case, partly because querying the inlined worker code would be pretty messy and it is something where manually running the playground catches the issue pretty easily.
Other details are mentioned via comments in
worker.ts
.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).