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

Sourcemap sourceRoot missing trailing slash #41

Open
cdauth opened this issue Oct 1, 2023 · 0 comments
Open

Sourcemap sourceRoot missing trailing slash #41

cdauth opened this issue Oct 1, 2023 · 0 comments

Comments

@cdauth
Copy link

cdauth commented Oct 1, 2023

Here is an example exception thrown in my app:

Error: ENOENT: no such file or directory, open '/home/cdauth/Documents/workspace/programming/web/osm/facilmap/server/node_modules/cache/GeoLite2-City.mmdb.tmp'
    at <anonymous> (/home/cdauth/Documents/workspace/programming/web/osm/facilmap/serversrc/geoip.ts:42:1)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

If you look at the path of the first item in the stack trace, there is a slash missing between server and src, making it impossible to click the file path.

The problem seems to come from this line. According to the source map specification, the sourceRoot value is simply prepended to all file paths. This means that the sourceRoot value needs to end with a trailing slash.

As a workaround, I specify the following in my esrun config object:

await esrun("./server.ts", {
	esbuildOptions: {
		sourceRoot: `${process.cwd()}/`
	}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant