rolldown: [Bug]: passes TypeScript experimental decorators as-is
Reproduction link or steps
- Open https://stackblitz.com/edit/github-6jajke-stx58g?file=rolldown.config.mjs
npm run buildruns automatically.- The output contains experimental decorators as-is.
What is expected?
Either
- Throw an error that says “experimental decorators are not supported yet”
- Read the tsconfig and transform experimental decorators to valid JS if enabled
What is actually happening?
Experimental decorators are passes as-is even if it’s not a valid JS.
System Info
Stackblitz
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.20.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
rolldown: https://pkg.pr.new/rolldown@351d2c7 => 0.13.2
Any additional comments?
Faced this while trying rolldown with Vite.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 35 (13 by maintainers)
Commits related to this issue
- feat(transformer): support for transforming legacy decorator (#8614) related: #4047 related: https://github.com/rolldown/rolldown/issues/2296 This is also known as "Experimental Decorator" in `TypeS... — committed to oxc-project/oxc by Dunqing 2 years ago
- feat(transformer): support for transforming legacy decorator (#8614) related: #4047 related: https://github.com/rolldown/rolldown/issues/2296 This is also known as "Experimental Decorator" in `TypeS... — committed to oxc-project/oxc by Dunqing 2 years ago
- feat: add more fields in tsconfig#CompilerOptionsSerde (#374) related issues: 1. https://github.com/rolldown/rolldown/issues/2296 2. https://github.com/rolldown/rolldown/issues/3473 These issue... — committed to oxc-project/oxc-resolver by IWANABETHATGUY 2 years ago
- feat: auto merge options from tsconfig to transformOption (#3566) <!-- Thank you for contributing! --> ### Description 1.Closed https://github.com/rolldown/rolldown/issues/2296 2. Closed https://git... — committed to rolldown/rolldown by IWANABETHATGUY 2 years ago
I got the version from the stackblitz example. rolldown: 1.0.0-beta.3-commit.1910872
It seems to not be active without rolldown resolving the tsconfig file.
"experimentalDecorators": true,probably activates the transform. So you need to add this to yourrolldown.config.ts:and also
tsconfig.json(you probably already have this)You will probably also need
@oxc-project/runtime. I got warnings that rolldown could not resolve those modules. It will then externalize these modules and not bundle the needed helpers, so you might need to add this dependency as well.tracked it https://github.com/oxc-project/oxc/issues/9129
https://github.com/oxc-project/oxc/pull/9057
Yeah, we are waiting
oxcto support thisthe oxc has already finished
experimentaldecorator transformation, try next nightly.Yeah, we will discuss the priority after oxc team finishes
es6target lowering.oxc team did not have enough bandwidth to work on this, they may start working this task after finish es2015 target lowering.