Closed samuelgozi closed 4 years ago
Create a custom config and tell your user to do this:
{
"extends": "parcel-config-svelte"
}
(Example config plugin https://github.com/parcel-bundler/parcel/tree/v2/packages/configs/default)
@mischnic mmm... I'm not sure if I didn't understand the answer or you didn't understand the question.
What I meant, Is that I(the transformer creator) want to spare the need of my users(the ones using this transformer in their project) to add anything to their configuration files for my transformer to work with the files it supports.
So in other words, I just want the users of my transformers to add the transformer dependency to their package.json dependencies, and the transformer will by itself tell parcel what files it can handle.
And thanks for the swift reply!
What I meant, Is that I(the transformer creator) want to spare the need of my users(the ones using this transformer in their project) to add anything to their configuration files for my transformer to work with the files it supports.
No, that isn't possible.
So in other words, I just want the users of my transformers to add the transformer dependency to their package.json dependencies, and the transformer will by itself tell parcel what files it can handle.
No, that isn't possible.
The only alternative to the transforms: *.svelte
approach creating a custom config (https://github.com/parcel-bundler/parcel/issues/3867#issuecomment-561210422) which would make the config file "smaller".
@mischnic Thank you very much for the answer. I have one last question. Is there any specific reason behind this? I'm asking because if not then I will open a feature request.
The issue with Parcel 1's plugin system (which is what you want) is that if multiple plugins that want to process the same asset type will overwrite each other (or aren't in the correct order or shouldn't be run sequentially after all - e.g. should import "foo.md"
import a html rendering, a react component, the plain file contents)
❔ Question
Is it possible to tell parcel "Hey I'll handle all files that match '*.test'" from within the transformer?
I know that the user can specify in his config:
But can I do that for them, like a register function or something?
🔦 Context
I'm migrating a transformer to v2 and trying to keep parcel "config free" when not necessary. I think that when the user explicitly installs a transformer, there is no need for them to specify which files it needs to handle, they know, and we know(the transformer) already.
🌍 Your Environment