8000 Cannot use with Stage 3 Decorators · Issue #381 · unjs/jiti · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Cannot use with Stage 3 Decorators #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

8000

Already on GitHub? Sign in to your account

Open
alexhanga opened this issue May 22, 2025 · 1 comment
Open

Cannot use with Stage 3 Decorators #381

alexhanga opened this issue May 22, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@alexhanga
Copy link

Environment

@better-auth/cli -> c12 -> jiti
Node 22.14.0

Reproduction

  1. Create a file with a Stage 3 decorator that trying to access context.kind (second argument of a decorator)
  2. Wrap some class with it
  3. Try to load config with it, receive error TypeError: Cannot read properties of undefined (reading 'kind')
  4. Try to add Babel plugin into transformOptions.babel.plugins, try again. Observe the same error

Describe the bug

My project uses latest Stage 3 Decorators proposal in our codebase, and we found that c12 uses jiti to load config. We tried to pass babel.plugins: ["@babel/plugin-proposal-decorators", { "version": "2023-11" }], but without any luck. It ends on the end of a list, so previous transformations already tried to convert code with legacy decorators.

Additional context

I've tried to load the config with just jiti, this is how I found that the error is in jiti setup. Patching c12 or @better-auth/cli doesn't provide any benefit

Logs

@alexhanga alexhanga added the bug Something isn't working label May 22, 2025
@alexhanga
Copy link
Author
alexhanga commented May 22, 2025

Sorry, wrong error. After running without cache, I've received error:

[Error: undefined: Cannot use the decorators and decorators-legacy plugin together

It seems that [proposalDecoratorsPlugin, { legacy: true }] and babel-plugin-parameter-decorator is the problem, and it's impossible to disable it outside

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant
0