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

How can .swcrc be configured so that swc will generate sourcemaps #1309

Closed
mmunte-impeo opened this issue Jan 1, 2021 · 2 comments · Fixed by #1440
Closed

How can .swcrc be configured so that swc will generate sourcemaps #1309

mmunte-impeo opened this issue Jan 1, 2021 · 2 comments · Fixed by #1440
Assignees
Milestone

Comments

@mmunte-impeo
Copy link

This is how my swcrc looks like.

I tried to read some of the rust source code but I could not understand how to correctly formulate the JSON below so that sourcemaps are generated.

[
  {
    "test": ".*.tsx",
    "jsc": {
      "target": "es2015",
      "parser": {
        "syntax": "typescript",
        "tsx": true
      }
    }
  },
  {
    "test": ".*.ts",
    "jsc": {
      "target": "es2015",
      "parser": {
        "syntax": "typescript",
        "tsx": false
      }
    }
  }
]
@kdy1 kdy1 modified the milestones: v1.2.47, v1.2.48 Jan 25, 2021
@kdy1 kdy1 modified the milestones: v1.2.48, v1.2.49, v1.2.50 Feb 19, 2021
@kdy1 kdy1 mentioned this issue Mar 1, 2021
4 tasks
@kdy1 kdy1 self-assigned this Mar 1, 2021
@kdy1 kdy1 closed this as completed in #1440 Mar 1, 2021
kdy1 added a commit that referenced this issue Mar 1, 2021
swc:
 - Use `hygiene_with_config` instead. (#1279)
 - Allow enabling source map with `.swcrc`. (#1309)

swc_ecma_transforms_base:
 - `hygiene`: Add an option to preserve class names. (#1279)

swc_ecma_transforms_compat:
 - `block_scoping`: Allow using `break` in switch cases. (#1415)
@Yaojian
Copy link

Yaojian commented Mar 20, 2021

Still no sourcemap generated on node.js for the given .swcrc:

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true,
      "dynamicImport": false,
      "decorators": false
    },
    "transform": {
      "legacyDecorator": true,
      "decoratorMetadata": true
    },
    "target": "es2016",
    "loose": false,
    "externalHelpers": true
  },
  "module": {
    "type": "commonjs",
    "strict": false,
    "strictMode": true,
    "lazy": false,
    "noInterop": false
  },
  "sourceMaps": true
}

package.json:

    "@swc/cli": "^0.1.35",
    "@swc/core": "^1.2.50",

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 25, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants