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

View generated JS to aid in debugging #58

Closed
x11x opened this issue Jul 10, 2022 · 1 comment
Closed

View generated JS to aid in debugging #58

x11x opened this issue Jul 10, 2022 · 1 comment
Labels

Comments

@x11x
Copy link

x11x commented Jul 10, 2022

Feature request

An option flag or environment variable that causes tsx to print the path to the generated JS code before executing.

Why?

I would like to be able to view the generated JS code to assist debugging. I know it is cached in $TMPDIR, so tsx could print the path to help finding it.

Alternatives

Alternatively, an option to dump the generated code straight to stdout/stderr before running.

Or maybe debugging options I have missed?

Or I could just compile my code directly using esbuild/tsc for debugging. But knowing exactly what code tsx is producing is useful, in case the result of using esbuild/tsc is not the same for whatever reason (different version, different config, etc.).

Additional context

Debugging is difficult due to error stack traces referencing generated JS, not the source. Have I missed something? I have tried enabling sourceMaps in tsconfig but still don't seem to be getting useful error stack traces. (I guess stack traces is a separate issue)
Thank you.

@x11x x11x added enhancement New feature or request pending triage labels Jul 10, 2022
@privatenumber
Copy link
Owner

privatenumber commented Jul 10, 2022

Thanks for the request.

Using tsx is designed to be as seamless as using Node.js so this will not be accepted.

With any JavaScript dependency, you can go into node_modules, (prettify the code if minified,) and add your own console.logs as necessary to debug.

If stack traces are inaccurate/broken for you, please file a bug.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants