Remove duplicate plugins when spread syntax is used in pipeline
Not sure if this is better as a feature request or as an issue, so I'm going to err on the side of caution and make a feature request.
feature request
Currently, if you are using the spread syntax (...) in a pipeline, parcel does not remove any duplicate plugins that are inherited.
For example, if you have the following config:
{
extends: "@parcel/config-default",
transformers: {
"*.{htm,html,xhtml}": [
"@parcel/transformer-posthtml",
"@example/my-html-transformer",
"...",
]
}
}Given the following upstream @parcel/config-default,
https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/configs/default/index.json#L37-L40
The intent of including @parcel/transformer-posthtml prior to the other transformers is that it should be run before them.
Expected Behavior
I would expect that when transforming an html file, parcel would apply the following transformation pipeline:
@parcel/transformer-posthtml@example/my-html-transformer@parcel/transformer-html
Current Behavior
However, currently it applies the following transformation pipeline:
@parcel/transformer-posthtml@example/my-html-transformer@parcel/transformer-posthtml@parcel/transformer-html
Possible Solution
I think the best way to handle this would be that during the flattening process, if a plugin occurs prior to the spread element, then it would not be added from the parent. However, if a plugin occurred twice, then that duplication would be preserved, e.g. it will not deduplicate plugins when explicitly requested.
Context
See above.
Examples
See above.
Source: parcel-bundler/parcel