Skip to content

Conversation

@technopahadi
Copy link
Contributor

Enable decorator parsing in SWC configuration to support codebases using
TypeScript decorators (TypeORM, NestJS, class-validator, custom decorators).

Without this fix, projects importing files with decorators fail with:
"Unexpected token @. Expected identifier..." syntax errors.

Changes:

  • Add decorators: true to parser options for TypeScript and ECMAScript
  • Add legacyDecorator: true for TypeScript's experimentalDecorators
  • Add decoratorMetadata: true for emitDecoratorMetadata support

  Enable decorator parsing in SWC configuration to support codebases using
  TypeScript decorators (TypeORM, NestJS, class-validator, custom decorators).

  Without this fix, projects importing files with decorators fail with:
  "Unexpected token `@`. Expected identifier..." syntax errors.

  Changes:
  - Add `decorators: true` to parser options for TypeScript and ECMAScript
  - Add `legacyDecorator: true` for TypeScript's experimentalDecorators
  - Add `decoratorMetadata: true` for emitDecoratorMetadata support
@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2026

⚠️ No Changeset found

Latest commit: 1ab79ef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Jan 9, 2026

@technopahadi is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@technopahadi
Copy link
Contributor Author

Fixes #756

  Read experimentalDecorators and emitDecoratorMetadata from tsconfig.json
  to match Next.js behavior. Decorators are now only enabled when explicitly
  configured in the project's tsconfig.

  - Add getDecoratorOptionsForDirectory() to read tsconfig settings
  - Update applySwcTransform and Next.js loader to use tsconfig options
  - Handle JSONC format (comments, trailing commas) in tsconfig parsing
technopahadi and others added 2 commits January 12, 2026 13:50
  Replace manual regex-based JSONC parsing with json5 library for more
  robust handling of comments and trailing commas in tsconfig.json files.
@vercel
Copy link
Contributor

vercel bot commented Jan 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Jan 12, 2026 8:34pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jan 12, 2026 8:34pm
example-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workbench-astro-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workbench-express-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workbench-fastify-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workbench-hono-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workbench-nitro-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workbench-nuxt-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workbench-vite-workflow Ready Ready Preview, Comment Jan 12, 2026 8:34pm
workflow-docs Ready Ready Preview, Comment Jan 12, 2026 8:34pm

ijjk
ijjk previously approved these changes Jan 12, 2026
Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the PR!

@ijjk ijjk dismissed their stale review January 12, 2026 20:54

vade suggestion

ijjk added 2 commits January 12, 2026 13:18
I, JJ Kasper <[email protected]>, hereby add my Signed-off-by to this commit: aa1dc36
I, JJ Kasper <[email protected]>, hereby add my Signed-off-by to this commit: e25f174

Signed-off-by: JJ Kasper <[email protected]>
@ijjk
Copy link
Member

ijjk commented Jan 12, 2026

I, Rishabh <[email protected]>, hereby add my Signed-off-by to this commit: e2f9304
I, Rishabh <[email protected]>, hereby add my Signed-off-by to this commit: 3faee5d
I, Rishabh <[email protected]>, hereby add my Signed-off-by to this commit: 9dbbda6

Signed-off-by: Rishabh <[email protected]>
@technopahadi
Copy link
Contributor Author

@ijjk Done

@ijjk ijjk merged commit 97c7875 into vercel:main Jan 13, 2026
3 of 15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants