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

Handle file:/// URLs in source-map-support cache lookup #1060

Closed
cspotcode opened this issue May 28, 2020 · 0 comments · Fixed by #1087
Closed

Handle file:/// URLs in source-map-support cache lookup #1060

cspotcode opened this issue May 28, 2020 · 0 comments · Fixed by #1087
Labels
bug you can do this Good candidate for a pull request.

Comments

@cspotcode
Copy link
Collaborator

cspotcode commented May 28, 2020

Reported here: #1007 (comment)

https://github.com/TypeStrong/ts-node/blob/master/src/index.ts#L445-L451
Does not handle file:// URLs when checking our outputCache. ESM modules have a URL instead of a path. So source-map-support is unable to get access to the sourcemaps, and stack traces are wrong for ESM modules.

Fix is to robustly check for a file URL. If found, convert to a path, then normalize slashes, then lookup in the cache.

Node's url.fileURLToPath should help.

@cspotcode cspotcode added bug you can do this Good candidate for a pull request. labels Jun 2, 2020
cspotcode added a commit that referenced this issue Jul 29, 2020
@cspotcode cspotcode mentioned this issue Jul 29, 2020
cspotcode added a commit that referenced this issue Jul 29, 2020
* Fix #1060

* fix linter failures

* fix lint failure

* fix test coverage

* fix tests on windows

* generous timeout for npm install before() hook hopefully to avoid CI timeouts
@cspotcode cspotcode mentioned this issue Aug 21, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug you can do this Good candidate for a pull request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant