-
-
Notifications
You must be signed in to change notification settings - Fork 265
Open
Description
High level problem: when I don't want tsup to build target > es2021, but do use emitDecoratorMetadata, I'm forced to opt-in to SWC transforms that break my legacy decorators.
See
Lines 32 to 41 in 769aa49
| parser: { | |
| syntax: isTs ? 'typescript' : 'ecmascript', | |
| decorators: true, | |
| }, | |
| transform: { | |
| legacyDecorator: true, | |
| decoratorMetadata: true, | |
| }, | |
| keepClassNames: true, | |
| target: 'es2022', |
Note that esbuild automatically detects the useDefineForClassFields tsconfig option. But SWC does not (automatically).
Two things:
- Set the
transformoption like so https://swc.rs/docs/configuration/compilation#jsctransformusedefineforclassfields inferred viatargetor from the user's tsconfig - Set the
targetbased on that of tsup config? I'm not sure if the hardcoded es2022 is intentional / for a reason (ie esbuild for down-level it better)
I'd be happy to try and do this in a PR
Metadata
Metadata
Assignees
Labels
No labels