cli icon indicating copy to clipboard operation
cli copied to clipboard

Unable to disable source maps

Open stefee opened this issue 4 years ago • 3 comments

Reproduction using @swc/[email protected].

scripts/.swcrc contents:

{
  "jsc": {
    "parser": {
      "syntax": "typescript"
    },
    "target": "es2021"
  }
}

Steps:

  1. node_modules/.bin/swc promiseSettledAggregate.ts -o dist/promiseSettledAggregate.js --config-file scripts/.swcrc
  2. See added promiseSettledAggregate.js.map in dist
  3. Delete dist/promiseSettledAggregate.js.map
  4. Run npm install @swc/[email protected] and re-run first step, and see now there is no longer promiseSettledAggregate.js.map

Expected behaviour:

Only emit promiseSettledAggregate.js.map if sourceMaps is enabled in config file. Do not emit if sourceMaps is omitted or set to false.

stefee avatar Oct 08 '21 13:10 stefee

It seems the issue is swc is not reading sourceMaps boolean value correctly from .swcrc - only "inline" has effect, but not true or false - sourcemaps will always be generated unless "inline" is specified.

I have found that this issue is consistent whether using --config-file flag on CLI or not.

stefee avatar Oct 08 '21 15:10 stefee

I haven't had time to investigate this yet but I am still seeing this bug on latest version @kdy1 - do you know the cause?

stefee avatar Oct 30 '21 13:10 stefee

No, I don't know how sourceMaps can be true while there's no .swcrc and sourceMaps is not specified while invoking @swc/core

kdy1 avatar Oct 30 '21 14:10 kdy1