Skip to content
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.

Already on GitHub? Sign in to your account

0.2.0 fails when run in conjunction with ts-node/esm and decorators #9

Open
justinmchase opened this issue Dec 16, 2022 · 2 comments
Open

Comments

@justinmchase
Copy link

My project is in typescript and I'm using ts-node/esm loader also. My code has decorators in the code. When I revert back to 0.1.0 of this project it works.

This is the error:

SyntaxError[ @/Users/jchase24/code/recovery/apps/recovery-auth-api/src/controllers/auth.controller.test.ts ]: /Users/jchase24/code/recovery/apps/recovery-auth-api/src/controllers/auth.controller.ts: Support for the experimental syntax 'decorators' isn't currently enabled (45:1):

  43 | import { ConfigService } from '../services/config/config.service.js'
  44 |
> 45 | @ApiPath({
     | ^
  46 |   path: '/',
  47 |   name: 'Authentication'
  48 | })

Add @babel/plugin-proposal-decorators (https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-decorators) to the 'plugins' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-decorators (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decorators) to the 'plugins' section to enable parsing.
    at instantiate (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parse-error/credentials.ts:62:21)
    at toParseError (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parse-error.ts:60:12)
    at Parser.raise (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/tokenizer/index.ts:1474:19)
    at Parser.expectOnePlugin (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/tokenizer/index.ts:1539:18)
    at Parser.parseDecorator (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/statement.ts:713:10)
    at Parser.parseDecorators (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/statement.ts:692:28)
    at Parser.parseStatementLike (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/statement.ts:418:25)
    at Parser.parseModuleItem (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/statement.ts:365:17)
    at Parser.parseBlockOrModuleBlockBody (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/statement.ts:1345:16)
    at Parser.parseBlockBody (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/statement.ts:1319:10)
    at Parser.parseProgram (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/statement.ts:226:10)
    at Parser.parseTopLevel (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/statement.ts:208:25)
    at Parser.parse (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/parser/index.ts:45:10)
    at parse (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/parser/src/index.ts:67:38)
    at parser (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/core/src/parser/index.ts:28:19)
    at parser.next (<anonymous>)
    at normalizeFile (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/core/src/transformation/normalize-file.ts:52:24)
    at normalizeFile.next (<anonymous>)
    at run (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/core/src/transformation/index.ts:38:36)
    at run.next (<anonymous>)
    at transform (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/core/src/transform.ts:29:20)
    at transform.next (<anonymous>)
    at step (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/gensync/index.js:261:32)
    at /Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/gensync/index.js:223:11)
    at cb (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/gensync/index.js:189:28)
    at /Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/@babel/core/src/gensync-utils/async.ts:90:7
    at /Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/gensync/index.js:113:33
    at step (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/gensync/index.js:287:14)
    at /Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/jchase24/code/recovery/apps/recovery-auth-api/node_modules/gensync/index.js:223:11)
@justinmchase
Copy link
Author

I tried adding a .babelrc and a babel section to my package.json and I tried adding the missing decorator plugins it seems like its asking for but it didn't work. This library must be passing in a custom babel configuration which ignores all of my local configuration maybe?

@pcan
Copy link

pcan commented Dec 21, 2024

This PR could help to solve this issue. @coreyfarrell would you mind having a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants