Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Feature Request: Handle TypeScript Better #34

Closed
jacob-israel-turner opened this issue Jul 23, 2018 · 15 comments · Fixed by #109
Closed

Feature Request: Handle TypeScript Better #34

jacob-israel-turner opened this issue Jul 23, 2018 · 15 comments · Fixed by #109

Comments

@jacob-israel-turner
Copy link

jacob-israel-turner commented Jul 23, 2018

Steps to reproduce

Tell us about your environment:

  • ndb version: v1.0.6
  • Platform / OS version: Ubuntu 16.04
  • Node.js version: v8.10.0

What steps will reproduce the problem?

Please include code that reproduces the issue.

I followed this guide, hoping it would work out essentially the same. It _kind of _ works. I opened ndb with ndb . in the root of my project, then ran one of my npm scripts from the ndb UI. The script was ts-node src/index.ts (I had to move my typings around a bit before this would work), and it ran just fine from inside ndb. Unfortunately, after starting the script, I could not set breakpoints in any of the files listed by ndb. However, if I stopped the script, set a breakpoint in one of the .ts files (specifically, src/inxex.ts), then restarted the script, ndb would start up and open a new file. This file matches what the article linked above led me to expect - the tab says the file is index.ts?[sm]. However, I cannot actually select this or other files from the list of files presented in the UI by ndb.

At this point, with the already-opened index.ts?[sm] file, I can move the breakpoint around and it appears to work fine.

What is the expected result?
If sourcemaps are available, the sourcemapped files should be available instead (or at least in addition to) the normal .ts files.

What happens instead?
They are not listed in the UI.

@jacob-israel-turner
Copy link
Author

Also note, the sourcemapped files appear in the file finder (ctrl-p) as well.

@jacob-israel-turner
Copy link
Author

It also appears that local changes are unable to be written to disk in .ts files.

screenshot from 2018-07-23 15-58-00

@jacob-israel-turner jacob-israel-turner changed the title Feature Request: Handle TypeScript breakpoints better Feature Request: Handle TypeScript Jul 23, 2018
@tangfang23
Copy link

Ok

@jacob-israel-turner jacob-israel-turner changed the title Feature Request: Handle TypeScript Feature Request: Handle TypeScript Better Jul 24, 2018
@hinell
Copy link

hinell commented Jul 31, 2018

Looks like chromium doesn't recognizes source maps currently.
The Chrome 68 does fine for me as well (Win 10 x64).

alexkozy added a commit that referenced this issue Jul 31, 2018
If we have target file with the same content inside file system we
can just clear sourceContent.

Fixes #34
@alexkozy
Copy link
Contributor

Latest ndb version (1.0.17) contains a fix for ts-node. Please check it out and feel free to reopen this issue if it still a problem.

@hinell
Copy link

hinell commented Jul 31, 2018

@ak239 Still doesn't work. If I use something like ndb node -r ts-node/register index.ts
I get the following error after exiting program.:

Expand errors
fs.js:119
    throw err;
    ^
Error: EPERM: operation not permitted, unlink 'UserName\AppData\Local\Temp\ndb-SU1uJo\BrowserMetrics\BrowserMetrics-5B60EFFF-2214.pma'
    at Object.unlinkSync (fs.js:925:3)
    at fixWinEPERMSync (UserName\AppData\Roaming\npm\node_modules\ndb\node_modules\rimraf\rimraf.js:211:13)
    at rimrafSync (UserName\AppData\Roaming\npm\node_modules\ndb\node_modules\rimraf\rimraf.js:311:28)
    at UserName\AppData\Roaming\npm\node_modules\ndb\node_modules\rimraf\rimraf.js:342:5
    at Array.forEach ()
    at rmkidsSync (UserName\AppData\Roaming\npm\node_modules\ndb\node_modules\rimraf\rimraf.js:341:26)
    at rmdirSync (UserName\AppData\Roaming\npm\node_modules\ndb\node_modules\rimraf\rimraf.js:334:7)
    at fixWinEPERMSync (UserName\AppData\Roaming\npm\node_modules\ndb\node_modules\rimraf\rimraf.js:209:5)
    at rimrafSync (UserName\AppData\Roaming\npm\node_modules\ndb\node_modules\rimraf\rimraf.js:311:28)
    at UserName\AppData\Roaming\npm\node_modules\ndb\node_modules\rimraf\rimraf.js:342:5

@alexkozy
Copy link
Contributor

Based on stack trace it looks like error at exit. Does source map work when ndb is running or is it immediately closed after start?

@alexkozy alexkozy reopened this Jul 31, 2018
@jacob-israel-turner
Copy link
Author

jacob-israel-turner commented Aug 1, 2018

I just upgraded to v1.0.17. I do not get that error when exiting. However, running scripts ts-node src/index.ts or node -r ts-node/register src/index.ts from within ndb do not make breakpoints work. In fact, it's more broken than before - index.ts?[sm] no longer shows up in the fuzzy finder, so I cannot use the workaround anymore.

EDIT: It looks like saving to disk from ndb works properly now.
EDIT2: If I go to my dist folder and try to attach a breakpoint there, it is still ignored. Perhaps I just have something misconfigured on my end.

@alexkozy
Copy link
Contributor

alexkozy commented Aug 1, 2018

Does your ts file get little green dot next to its tab and if you try to set breakpoint inside this ts file, does breakpoint stay there are jump to some other file?
I will definitely debug it more.

@jacob-israel-turner
Copy link
Author

Yes, all of my .ts files have a green dot on them. The breakpoint stays in the .ts file I place it in, but it doesn't pause when executing.

@hinell
Copy link

hinell commented Aug 1, 2018

@ak239
The source maps are recognized but breakpoints don't. The program doesn't pause at the breakpoint set in the index.ts file. When ndb is running no error is shown. Only after exiting program by the ctrl + c stroke.

@alexkozy alexkozy reopened this Aug 4, 2018
alexkozy added a commit that referenced this issue Aug 7, 2018
Latest roll contains uiLocationToRawLocations method that should
fix source maps on frontend side.

Fixes #34
@alexkozy
Copy link
Contributor

alexkozy commented Aug 7, 2018

Finally this one should be fixed in just published 1.0.20. Please check it out. 😄

@Yogu
Copy link

Yogu commented Sep 13, 2018

Sourcemaps are available for me, but breakpoints don't work (on Windows). It seems like a relative/absolute path handling error. If I click on a typescript line, a new file opens with the filename "/", e.g. "file:///C:/dir/C:\dir\file", which is empty.

Should I open a new issue? This can be reproduced with cruddl by running ndb cruddl-dev.js on Windows.

@0x-r4bbit
Copy link

I'm experiencing the same. Breakpoints are just ignore when executing code.

Anything that needs to be done to make ndb aware of the sourcemaps?

@ankur123
Copy link

I am seeing the same issue as well

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants