You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
Currently debugging with webpack is available but you cannot debug the original source -- enable this functionality by inlining source maps when app is started with tns debug ... --bundle command.
Debugging with source maps should be supported both from chrome devtools as well as vscode.
Also [for typescript projects], it seems there is something different about how https://github.com/s-panferov/awesome-typescript-loader handles inline-source-map vs inline-cheap-module-source-map webpack devtool option (the former is automagically handled by the loader, while the latter isn't). This(?) results in a different folder structure generated for the webpack:// protocol.
TypeScript project with inline-source-map:
TypeScript project with inline-cheap-module-source-map:
Ultimately this requires different sourceMapPathOverrides in the NativeScript vscode extension:
@NickIliev thanks for the fast reply. I have followed the instructions and am running nativescript-dev-webpack@0.15.0 - removed node_modules platforms hooks folders, and began the debug session.
I also updated my webpack.config.js to match the new settings by running the updater script and then reapplying my small changes.
that was the missing piece in my webpack config which needed to be enabled. At first I forgot that line, no sourcemaps. Now it works. Thank you!
Only thing now is, it is showing the generated JS instead of the source TS. The file names are mapped properly, but not the TS source. Hmm... any ideas?
@IAMtheIAM you should see the TS files (if debugging TS or Angular project) at least these are the files I am seeing through my test project. The TS files (along with all XML, CSS) in ChromeDevTools should be located in
@NickIliev I still dont see the correct stacktrace with the latest dev webpack.
I run my app through the terminal using tns run anroid --bundle --env.sourceMap
And i get stacktrace like that on error:
Ideally, you need the source maps during debug - is the issue present when you execute debug instead of run (for Chrome DevTools) .. for VSCOde debug you would use the debug interface and again not the run command.
If you are having troubles with debug then please open a new issue while describing the case in details.
@NickIliev I'm running tns debug ios --hmr - should I see .ts source line numbers on console.log() calls? All console. calls are originating from app/0.js. Ex:
Why is this not default? I've watched an old video tutorial of nativescript and they just launch the debugger in VSCode and it just works. Didn't change anything to launch.json. Is this a problem within nativescript extension in VSCode?
Activity
manoldonev commentedon Jul 6, 2018
Comparison of webpack performance without source maps, with inline-cheap-module-source-map, and with inline-source-map:

Tests executed on https://github.com/NativeScript/nativescript-sdk-examples-ng and https://github.com/NativeScript/nativescript-sdk-examples-js apps and represent the "total" column (in seconds) from the
time ./node_modules/.bin/webpack --env.androidcommand output (e.g../node_modules/.bin/webpack --env.android 3.71s user 0.39s system 109% cpu 3.733 total).manoldonev commentedon Jul 6, 2018
Also [for typescript projects], it seems there is something different about how https://github.com/s-panferov/awesome-typescript-loader handles inline-source-map vs inline-cheap-module-source-map webpack devtool option (the former is automagically handled by the loader, while the latter isn't). This(?) results in a different folder structure generated for the webpack:// protocol.
TypeScript project with inline-source-map:

TypeScript project with inline-cheap-module-source-map:

Ultimately this requires different
sourceMapPathOverridesin the NativeScript vscode extension:inline-source-map:
inline-cheap-module-source-map:
feat: add source map paths for debugging with webpack
IAMtheIAM commentedon Jul 31, 2018
I tried adding
-env.sourceMapbut it did nothing to my webpack bundle. Is this merged into NPM yet?NickIliev commentedon Aug 1, 2018
@IAMtheIAM you don't need to provide
--env.sourceMapjust the latest nativescript-dev-webpack (version 0.15.0 and above)To enable debugging of a bundled app (Webpacked) with Chrome Dev Tools use
If you want to debug a Webpack enabled app with VSCode you need to manually add
tnsArgs: ["--bundle"]to thelaunch.jsonand the options in launch.json should look like this one
IAMtheIAM commentedon Aug 1, 2018
@NickIliev thanks for the fast reply. I have followed the instructions and am running
nativescript-dev-webpack@0.15.0- removednode_modules platforms hooksfolders, and began the debug session.I also updated my webpack.config.js to match the new settings by running the updater script and then reapplying my small changes.
It works
devtool: sourceMap ? "inline-source-map" : "none",that was the missing piece in my webpack config which needed to be enabled. At first I forgot that line, no sourcemaps. Now it works. Thank you!
Only thing now is, it is showing the generated JS instead of the source TS. The file names are mapped properly, but not the TS source. Hmm... any ideas?
NickIliev commentedon Aug 2, 2018
@IAMtheIAM you should see the TS files (if debugging TS or Angular project) at least these are the files I am seeing through my test project. The TS files (along with all XML, CSS) in ChromeDevTools should be located in
Elements tab >
webpack://>.NickIliev commentedon Aug 7, 2018
Implemented in the latest nativescript-dev-webpack via the linked PRs
farfromrefug commentedon Feb 25, 2019
@NickIliev I still dont see the correct stacktrace with the latest dev webpack.
I run my app through the terminal using
tns run anroid --bundle --env.sourceMapAnd i get stacktrace like that on error:
The source map is present in the compiled js files but the source map is not used on "print".
Any way to fix that? Should i create another issue?
NickIliev commentedon Feb 25, 2019
@farfromrefug
debuginstead ofrun(for Chrome DevTools) .. for VSCOde debug you would use the debug interface and again not theruncommand.If you are having troubles with
debugthen please open a new issue while describing the case in details.farfromrefug commentedon Feb 25, 2019
@NickIliev i am not running through vscode debugger. Only
tns runthrough terminal.I think
tns runshould also "translate" the stacktracerynop commentedon May 14, 2019
@NickIliev I'm running
tns debug ios --hmr- should I see.tssource line numbers onconsole.log()calls? Allconsole.calls are originating fromapp/0.js. Ex:if not, is there a way for
console.to honor source maps?PS: love hmr BTW. Great work!
farfromrefug commentedon May 14, 2019
@rynop there is a bug in the cli. it won't translate for webpack projects. I opened an issue there
arielnmz commentedon Jun 26, 2019
Can you link to the other issue?
jessecrossen commentedon Aug 1, 2019
@arielnmz I'm guessing it's this issue, in case anyone else is looking for it: NativeScript/nativescript-cli#4604
mrkvn commentedon Feb 11, 2021
As mentioned by @NickIliev, adding the following to
launch.jsonfix it for me (thoughappis changed tosrc):Why is this not default? I've watched an old video tutorial of nativescript and they just launch the debugger in VSCode and it just works. Didn't change anything to
launch.json. Is this a problem within nativescript extension in VSCode?