I have a React Native project (created from the Ignite CLI 2.0.0 default boilerplate) that needs some dependencies on node-based packages.
So, I created a transformers.js
, babel-transform.js
and a rn-cli.js
according to ReactNativify. This is basically equivalent to what's in a normal .babelrc
file and uses babel-plugin-rewrite-require
to swap out Node objects and replace them either with Browserify shims, or empty mocks. So far, so good.
Now the problem is debugging this in Visual Studio Code (1.13.1
). I've had a significant adventure (or horror story, if you will) with RN debugging already, but thought to have it running after downgrading Node to 7.10.1
.
Everything seems to go well, does halt on breakpoints, steps through code, etc., however this is the actual code not the transpiled output with the shims in place! Furthermore breakpoints open in a read-only code window that has no code indentation.
My debug configuration is:
{
"type": "node",
"request": "launch",
"name": "Launch Tests",
"program": "${workspaceRoot}/node_modules/.bin/jest",
"args": [
"--runInBand",
"--no-cache"
]
// Not needed, but tried ;)
// "runtimeArgs": [
// "--debug-brk=127.0.0.1:5858"
// ],
// "port": 5858
}
Does anyone have similar, hopefully better experience with this?
PS. There may be a vscode github issue (#26782) related to this.