question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sourcemaps do not work

See original GitHub issue

Thanks for the nice package. I have issues making sourcemaps work. I have tried adding --no-cache but I’m still getting error lines of transpiled source (or did I miss anything that console errors should be mapped to correct line?)

Here is my package.json

{
  "scripts": {
    "test": "jest --no-cache",
  },
  ...
  "jest": {
     "globals": {
      "__TS_CONFIG__": "tsconfig.test.json"
    },
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/.storybook/__mocks__/fileMock.js",
      "\\.(css|less)$": "<rootDir>/.storybook/__mocks__/styleMock.js"
    },
    "setupFiles": [
      "<rootDir>/jest.startup.js"
    ],
    "transform": {
      ".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
    },
    "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ],
    "snapshotSerializers": [
      "<rootDir>/node_modules/enzyme-to-json/serializer"
    ]
  }
}

And here is the tsconfig.test.json

{
    "compileOnSave": false,
    "compilerOptions": {
        "allowSyntheticDefaultImports": true,
        "lib": [
            "dom",
            "es2015",
            "es2016"
        ],
        "noEmitHelpers": false,
        "emitDecoratorMetadata": true,
        "jsx": "react",
        "target": "es2016",
        "module": "commonjs",
        "moduleResolution": "node",
        "removeComments": true,
        "preserveConstEnums": true,
        "sourceMap": true,
        "strictNullChecks": false,
        "noImplicitReturns": true,
        "noImplicitThis": true,
        "noUnusedLocals": false,
        "noUnusedParameters": true,
        "skipLibCheck": true,
        "skipDefaultLibCheck": true,
        "experimentalDecorators": true,
        "outDir": "./build",
        "types": [
            "chai",
            "react"
        ],
        "typeRoots": [
            "src/typings/overrides",
            "node_modules/@types"
        ],
        "pretty": true
    },
    "exclude": [
        "node_modules"
    ]
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

13reactions
villelahdenvuocommented, Jul 22, 2019

I was also struggling with broken sourcemaps, but disabling coverage made them work! I’m using Jest 24.5.0. I just changed my debug script to add --coverage=false and sourcemaps started working.

3reactions
kirillgroshkovcommented, Oct 6, 2017

sourcemaps are not working for me as well…

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Reasons Why Your Source Maps are Broken - Sentry Blog
4 Reasons Why Your Source Maps are Broken · Missing or incorrect source map directive · Missing original source files · Bad source...
Read more >
Source Maps not working with Webpack - Stack Overflow
In bundle.js you will see original transpiled webpack bundle - this is normal behaviour. Open webpack:// and you will see your project files ......
Read more >
web pack source map not working for some devtool options.
Sourcemap is not working for some devtool options. Tested options: eval: working ... source map should work in all devtool options.
Read more >
The source maps don't work in Developer Tools when ...
When I am using the Developer Tools in the browser the javascript source map is extracted and I can debug files separately. When...
Read more >
source-map-loader - webpack
Disclaimer: source-map-loader is a third-party package maintained by community members, it potentially does not have the same support, security policy or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found