Skip to content

How do I debug Typescript file in VS code for a NativeScript project ? #9693

Discussion options

You must be logged in to vote

Hi @monishakhapali in your launch.config in VS Code you can add sourceMapPathOverrides as follows:

{
    "name": "Attach on iOS",
    "type": "nativescript",
    "request": "attach",
    "platform": "ios",
    "appRoot": "${workspaceRoot}",
    "sourceMaps": true,
    "watch": false,
    "sourceMapPathOverrides": {
        "webpack://app/./*": "${workspaceRoot}/*",
    }
},

Then in webpack.config.js add this:

const webpack = require("@nativescript/webpack");

module.exports = (env) => {
	webpack.init(env);

	// for vs code debugger:
	webpack.chainWebpack(config => {
		config.output.devtoolNamespace('app')
	})

	return webpack.resolveConfig();
};

Then in the VS Code Terminal you can run n…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@NathanWalker
Comment options

Answer selected by NathanWalker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants