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

Native support of TSX #57079

Closed
vadimkantorov opened this issue Feb 15, 2025 · 6 comments
Closed

Native support of TSX #57079

vadimkantorov opened this issue Feb 15, 2025 · 6 comments
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@vadimkantorov
Copy link

vadimkantorov commented Feb 15, 2025

What is the problem this feature will solve?

It will simplify a lot the life of novices to web-dev ecosystem to have simpler support for running server-side rendering using TSX

My usecase: simple server-side rendering of Lexical JSON's https://github.com/vadimkantorov/lexical-cli-render from CLI. Currently I had to use ts-node, because Node did not support importing custom controls defined in TSX.

Discussed it in https://github.com/orgs/nodejs/discussions/57070

What is the feature you are proposing to solve the problem?

It appears that SWC (used by Amaro under the hood) already has support for TSX: https://swc.rs/blog/swc-1#typescript-support

But it seems disabled by Node: https://nodejs.org/api/typescript.html#determining-module-system

I assume that deciding on TSX support should also correlate somehow with decisions on JSX:

In this linked issue the main blocker seems to be design of running various code transformations. I hope it does not block the feature, as even streamlining some basic usecases would be of great help to novices.

What alternatives have you considered?

No response

@vadimkantorov vadimkantorov added the feature request Issues that request new features to be added to Node.js. label Feb 15, 2025
@github-project-automation github-project-automation bot moved this to Awaiting Triage in Node.js feature requests Feb 15, 2025
@ljharb
Copy link
Member

ljharb commented Feb 16, 2025

I think this is mostly a duplicate of #56822, because that’s the hard part here.

@vadimkantorov
Copy link
Author

vadimkantorov commented Feb 16, 2025

My take on this issue would be at least shipping a bunch of official loaders to make using tsx with nodejs more streamlined and well-tested (even if for time being the user must explicitly specify the required loader), even without waiting for the proper design of configuring transformations

@arthurfiorette
Copy link

TSX is the coexistence of JSX and TS in the same file. And should not interference with each other. As soon as TS support is complete, JSX seems an obvious next step, but before finishing TS, it does not make sense.

TSX support will be the consequence of both TS and JSX support.

Seems duplicate of #56822.

@vadimkantorov
Copy link
Author

(If needed, please free to close this issue as duplicate)

@marco-ippolito
Copy link
Member

And we have a loader for tsx https://www.npmjs.com/package/@nodejs-loaders/tsx

@vadimkantorov
Copy link
Author

vadimkantorov commented Feb 18, 2025

I've tried using it but it did not like the tsx being imported from a ts file. Maybe it can be made work, but I didn't succeed and rolled back to ts-node :(

My code is at https://github.com/vadimkantorov/lexical-cli-render

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
Archived in project
Development

No branches or pull requests

4 participants