Skip to content

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

Description

@cspotcode

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions