parcel
parcel copied to clipboard
Support swc plugin
I want to use an swc plugin swc-plugin-transform-vue3-jsx for jsx, but parcel has no way to add swc plugin.
We would like to use swc-plugin-inferno instead of the default React JSX transformer.
https://github.com/parcel-bundler/parcel/discussions/9236
Any update on this?
We'd like to use this SWC plugin because then we can stop using babel and get faster builds but it doesn't seem possible? https://www.npmjs.com/package/@swc/plugin-emotion
It looks like this is related to the support of .swcrc (seeing #6335).
Doesn't it boil down to activating the configuration option swcrc everywhere Parcel uses SWC?
Looks like an easy win, considering I only see a few locations where SWC is called in the code:
- SwcOptimizer.js
- RequireInliningVisitor.js
- NodePackageManager.js
- InlineRequires.js
- RequireInliningVisitor.test.js
Am I completely off track? 🤔
The place where additional swc transformer plugins should run is https://github.com/parcel-bundler/parcel/blob/v2/packages/transformers/js/core/src/lib.rs
Or alternatively as a separate transformer, doing something like https://github.com/parcel-bundler/parcel/pull/9826
Thanks for your answers @mischnic.
What about supporting the .swcrc by default, tho ? What would it take ? :thinking:
My use case is supporting TS decorators.
Should I also use a dedicated transformer ? It looks like it could break earlier if SWC parses the code before transformation.
You should be able to enable them already:
https://github.com/parcel-bundler/parcel/tree/v2/packages/core/integration-tests/test/integration/decorators
https://parceljs.org/languages/typescript/#transpilation
Interesting (kind of a conf maze though). Thanks for the pointer, I'll try it, I have metadata in my decorators though, not sure this'll work without the SWC config.