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

Source map support for rewriting error #352

Open
stevefan1999-personal opened this issue Sep 17, 2024 · 2 comments
Open

Source map support for rewriting error #352

stevefan1999-personal opened this issue Sep 17, 2024 · 2 comments

Comments

@stevefan1999-personal
Copy link

stevefan1999-personal commented Sep 17, 2024

In Den the user have an option to include a Typescript transpiler (https://github.com/swc-project/swc) and the file will get transpiled to Javascript and also have an option to include the source map as a comment so that stack traces can be correctly remapped, however currently QuickJS does not take account into this and will the location of the error is often shifted away due to transpilation. Would be nice to include a basic support for source map so we can correctly print the right stack trace location.

Maybe related to #235

@saghul
Copy link
Contributor

saghul commented Sep 19, 2024

In order to get that you need a couple of things in place. We have them over at the friendly fork:

With those 2 thins in place you can use your own Error.prepareStackTrace hook and read the source map and replace the current trace.

@andrieshiemstra
Copy link

@saghul cool thanks! did not know about that one...

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

3 participants