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

Source map result different then babel-cli #547

Open
wiryonolau opened this issue Apr 12, 2022 · 0 comments
Open

Source map result different then babel-cli #547

wiryonolau opened this issue Apr 12, 2022 · 0 comments

Comments

@wiryonolau
Copy link

Hi after transpile the source map file has different content then when running using babel-cli

.babelrc

{
    "comments" : false,
    "sourceMaps": true,
    "only": [
        "./asset/js/src"
    ],
    "presets": [
        "@babel/preset-react",
        ["minify", {
            "mangle" : true,
            "builtIns": false,
            "keepClassName" : true
        }]
    ]
}

.languagebabel

{
    "babelMapsPath": "asset/js/dist",
    "babelMapsAddUrl": true,
    "babelSourcePath": "asset/js/src",
    "babelTranspilePath": "asset/js/dist",
    "createMap": true,
    "createTargetDirectories": false,
    "createTranspiledCode": true,
    "disableWhenNoBabelrcFileInPath": true,
    "suppressSourcePathMessages": false,
    "suppressTranspileOnSaveMessages": false,
    "transpileOnSave": true,
    "projectRoot": true
}

Result when transpile using language-babel

{
 "version": 3,
 "sources": [
  "../src/test.js"
 ],
 "file": "../src/test.js",
 "names": [
  "console",
  "log"
 ],
 "mappings": "AAAAA,OAAO,CAACC,GAAR,CAAY,UAAZ,C"
}

when transpile using babel-cli

babel src/ -d dist/ --source-maps
{
  "version": 3,
  "sources": [
    "../src/test.js"
  ],
  "names": [
    "console",
    "log"
  ],
  "mappings": "AAAAA,OAAO,CAACC,GAAR,CAAY,UAAZ,C",
  "sourcesContent": [
    "console.log(\"Test map\");\n"
  ],
  "file": "test.js"
}

The map file lack sourcesContent key

Is there missing config I haven't add ?

  "devDependencies": {
    "@babel/cli": "^7.17.6",
    "@babel/core": "^7.17.9",
    "@babel/preset-react": "^7.16.7",
    "babel-preset-minify": "^0.5.1"
  }
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

No branches or pull requests

1 participant