Closed Artur- closed 7 months ago
This is in a .ts
file, so it sounds like the plugin should not even process it.
This is either a bug in SWC (at least we could consider the parser should error and not panic) either an incompatibility between Lit and the spec (which I think is the case given this TS flag was removed from the lit template IIRC)
This plugins enforce standards for reason stayed here: https://github.com/vitejs/vite-plugin-react-swc/pull/178#issuecomment-1824272225, so it's either a won't fix or upstream issue.
Btw, it looks like it is possible to make this work with SWC, but only if a transform is passed to tell SWC not to use the legacy decorators but to use the new one. It looks like this package deliberately prevents the passing of such transforms.
See:
I understand that the reasons for not passing through transforms are to encourage the use of standard configurations and to encourage the use of new features. However, but right now this means that we can't use the newer non-legacy decorators.
Is there any prospect of a specific decorators switch so that we could use the non-legacy decorators without having to expose the whole of the transforms API, which causes concern?
I converted a project from using
vite-plugin-react
to using this because of https://github.com/vitejs/vite-plugin-react/issues/266 and initially it compiles fine. However, as this plugin enforcesuseDefineForClassFields
I need to addaccessor
to Lit Element properties for them to keep working (https://lit.dev/docs/components/properties/#avoiding-issues-with-class-fields).When I change something like
to
It all stops working with