Open
Description
Description
There are custom worker
configuration options, but it doesn't include the ability to customize its resolve
or conditions
config. Because of this, Vite's automatic handling of ?worker
(+other) imports doesnt correctly load Worker-specific dependencies nor does it give me a way to do so.
Suggested solution
The request is to either
A) automatically include worker
resolve condition when bundling a worker
probably breaking
B) expose more of the configuration to worker options so that I can quickly adjust w/o needing to rework the entire vite build to use custom envs
Thanks~!
Alternative
The alternative (afaict) is to
- Don't use `import Worker from './path?worker' at all
- Setup a custom environment that (re)defines all worker configuration, including the change in resolve conditions
- From client/main environment, instantiate my worker using hardcoded reference to the
environments.worker.output
path.
Additional context
When code is built within a worker, it should import from a given package's Worker-specific variant. Eg;
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.