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

Breakpoints do not work with a react native setup in Visual Studio Code #212

Closed
GeeWee opened this issue May 14, 2017 · 6 comments
Closed

Comments

@GeeWee
Copy link
Collaborator

GeeWee commented May 14, 2017

  • Issue

Breakpoints don't work in VSCode. If you use a debugger statement, it will break at the correct place, and show the correct sources, so the sourcemaps are being loaded and parsed.

billede

On every breakpoint VSCode reports:
breakpoint not ignored because generated code not found (source map problem?)

This issue is related to #209 - it is the same setup that works in webstorm.
Here are my config files.

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug Jest",
            "program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
            "args": ["--runInBand", "--no-cache"],
            "cwd": "${workspaceRoot}",
            "console": "integratedTerminal",
            "sourceMaps": true,
        }
    ]
}

Tsconfig:

{
    "compilerOptions": {
        "jsx": "react",
        "allowSyntheticDefaultImports": true,
        "target": "es2015",
        "moduleResolution": "node",
        "inlineSourceMap": true
    },
    "exclude": [
        "node_modules"
    ]
}

package.json>jest

	"jest": {
		"preset": "react-native",
		"transform": {
			"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
			".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
		},
		"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$",
		"mapCoverage": true,
		"moduleFileExtensions": [
			"ts",
			"tsx",
			"js",
			"json"
		],
		"globals": {
			"__DEV__": true
		}
	}

.babelrc

{
	"presets": [
		"react-native"
	],
	"sourceMaps": "inline"
}
  • Expected behavior

I expect it to break at the correct places.

  • Link to a minimal repo that reproduces this issue

https://github.com/GeeWee/rn-typescript-example/tree/ts-loader-bug
Here, simply run the debug configuration. It will stop at the debugger; statement but will ignore any breakpoints.

@kulshekhar
Copy link
Owner

@GeeWee I just tried this out and this seems to be working

  • jest 20.0.4
  • ts-jest 20.0.12
  • vscode 1.15.1
  • node 8.4

@GeeWee
Copy link
Collaborator Author

GeeWee commented Aug 30, 2017

Holy shit really? That's magical! Perhaps it has something to do with the new debugger protocol in node 8.

If so, we should definitely update the readme.

@kulshekhar
Copy link
Owner

lol .. yeah. I was just setting it up to see if #306 fixed this but it seemed to work just fine even with the current version. If you can confirm this works for you as well, it will close one major issue

@GeeWee
Copy link
Collaborator Author

GeeWee commented Aug 30, 2017

Yeah it works ! Damn. I wonder if this only works in node 8. Either way we should update the readme - this is awesome.

@kulshekhar
Copy link
Owner

That should be simple - just gotta take one section out :)

@morajabi
Copy link
Contributor

@GeeWee Every issue will be solved by itself... It's just the matter of time.

morajabi added a commit that referenced this issue Aug 30, 2017
* docs: unify package name styling

* docs: use backticks for pkg@version

* docs: remove `current limitations for vscode` & update the ToC

* docs: add ToC
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

3 participants