Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
avoid emit same file
case one:
match two times worker constructor avoids building two times. there will always use a first-time result. I think it will be ok because the worker plugin no deps any more info from the worker constructor.
this case it always emit rollup assets.
case two:
In this case, it may be emitting assets or chunks.
if the file is imported by the module package it will have the
export
expression and if the file is imported by the worker package it will have not theexport
expression so don't have the same file.if the above script is used in another worker, It also reports a warning. 馃槄
so I cache the same id, if emitted and don't emit next time.
avoid bundle same file
worker bundle doesn't deps on any more worker runtime info, so one id only had one result. Save worker bundled file id to avoid repeated execution of bundles. And if the worker had bundled, rewritten truth id, no need to replace by asset plugin.(because nested worker bundle context don't had file what emitted by outside bundle)
import.meta.url
in workerAs the unit test of the worker was originally improved, it was found that replacing the fix
import.meta.url
inside the define plugin would cause the nested worker to not be recognized. Now try to replace it in the chunkRender hook. 馃うWhat is the purpose of this pull request?