Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

SWC: using custom config in a root directory #30340

Closed
zetoke opened this issue Oct 26, 2021 · 2 comments
Closed

SWC: using custom config in a root directory #30340

zetoke opened this issue Oct 26, 2021 · 2 comments

Comments

@zetoke
Copy link

zetoke commented Oct 26, 2021

Describe the feature you'd like to request

It would be cool if Next.js can pickup a custom .swcrc config file in a project root directory.
For example, I have decorators in project's codebase and I have .swcrc file

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true,
      "dynamicImport": true,
      "decorators": true
    },
    "target": "es2021"
  },
  "module": {
    "type": "es6"
  }
}

So I turned on decorators support and tests are running just fine for the last weeks.
But Next.js struggle to compile it.

Error: error: Unexpected token `@`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, ` for template literal, (, or an identifier

Describe the solution you'd like

It would be cool if Next.js can pickup a custom .swcrc config file in a project root directory.

Describe alternatives you've considered

Next.js having all those things turned on by default may be?

@justinoboyle
Copy link

this has also been the only hurdle for us switching to swc: decorator support

similar config here in .swcrc:

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true,
      "decorators": true
    }
  }
}

congrats on the launch, by the way!

@salembaira
Copy link

Crossing fingers and waiting for this!

@vercel vercel locked and limited conversation to collaborators Oct 27, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants