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): support worker format, plugins and rollupOptions (#6191) #6243
Conversation
This reverts commit 0b3dd1b.
how can I update |
when I use |
Check previous discussions in #5390 (comment), but a factory seems unnecessary after further discussion with others in the team. For context, both in the PR and in #5390, users may include plugins that aren't intended to work in the bundling of workers (doing post-processing at build time for example). Plugins may also have cached that could be corrupted by being used in these extra rollup calls. If you check the current code, new internal Vite plugins are being recreated for each worker bundle. We discussed with the team and we think that the best we can do here is to let the user specify what plugins should be applied to workers, even if this means there will be some repetition in the config (but it could be easily avoided by extracting a common function).
@poyoho let us know if you want to work in the plugins part or if you have doubts with this approach, you could use this PR to do it. We can add each option in a different PR if that is better suited. |
oh, you are right. |
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.
Some comments & should we also add docs at https://github.com/vitejs/vite/blob/main/docs/config/index.md with Worker options
?
@patak-dev I tested this PR and this fixes #6191 but seems not fix #5402. Also, PR title seems incorrect for new worker options feature. |
I seem this PR set |
I think we can set it when the format is "es" @poyoho 👍🏼 |
may I add #5402 in the description? |
As far as I understand it tells rollup not to optimize for the worker's entry point, since that file doesn't export anything. I tried this patch out and it gives me the following error with the
As @patak-dev said above, we will need to move forward with defaulting to |
@poyoho could you add preserveEntrySignatures: false when the format is es? |
oh, sorry I forget commit |
I accidentally deleted repo before. How should I link this PR to the new branch😭 @patak-dev |
Maybe you could use gh. There is a code button next to the PR title that gives you the command to get this branch:
|
yes, I use this way to create the branch, but the branch from check out is out of sync with this pr |
That's strange, if you start from a clean repo or delete your branch, that command should get you to the right spot. I'll add the option and commit here now 👍🏼 |
It seems that this command (gh pr checkout 6243) will only check out a new branch I still have a few PR don't know what to do 😕 |
I see what you mean now by deleting the branch... I think we just confused GH. Maybe create a new PR and link to this one just in case? We don't get suggestions now also. I sent the commit here https://github.com/vitejs/vite/tree/fix/worker-with-plugin |
I think we should add |
yes, I think so. Worker don't need to export anything. I think worker.rollupOptions should be omit by |
Yes, good catch |
Status of this PR? How to help? |
IIUC, @poyoho is going to create a new PR for this one. We will merge this for 2.8 beta |
Description
fix: #6191
Additional context
shallow copy of the plugin config
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).