parcel icon indicating copy to clipboard operation
parcel copied to clipboard

Support swc plugin

Open takkuumi opened this issue 2 years ago • 9 comments

I want to use an swc plugin swc-plugin-transform-vue3-jsx for jsx, but parcel has no way to add swc plugin.

takkuumi avatar Nov 09 '22 01:11 takkuumi

We would like to use swc-plugin-inferno instead of the default React JSX transformer.

https://github.com/parcel-bundler/parcel/discussions/9236

jhsware avatar Sep 20 '23 07:09 jhsware

Any update on this?

ottoborden avatar Feb 06 '24 20:02 ottoborden

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

danieltroger avatar Jun 03 '24 15:06 danieltroger

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:

Am I completely off track? 🤔

quilicicf avatar Jul 02 '24 14:07 quilicicf

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

mischnic avatar Jul 02 '24 15:07 mischnic

Or alternatively as a separate transformer, doing something like https://github.com/parcel-bundler/parcel/pull/9826

mischnic avatar Jul 02 '24 15:07 mischnic

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.

quilicicf avatar Jul 03 '24 07:07 quilicicf

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

mischnic avatar Jul 04 '24 09:07 mischnic

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.

quilicicf avatar Jul 04 '24 15:07 quilicicf