Skip to content

Comments in .swcrc files #4146

@jasongerbes

Description

@jasongerbes

Describe the bug

The Configuring SWC docs contain several examples of .swcrc files with comments.

However, SWC cannot be used with a .swcrc file that contains any comments.

Config

{
  "jsc": {
    // Disable es3 / es5 / es2015 transforms
    "target": "es2016"
  }
}

Playground link

No response

Expected behavior

Ideally, .swcrc should use JSONC instead of JSON to allow the use of comments.

Actual behavior

SWC fails, with an error like:

Caused by:
    0: failed to read swcrc file (svg-sprite-generator/src/index.ts)
    1: failed to deserialize .swcrc (json) file: syntax error: 3:9
    2: key must be a string at line 3 column 9
failed to process input file

Version

0.1.52

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions