Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Why not use Build API of esbuild instead of Transform API? #9

Closed
AisonSu opened this issue May 26, 2022 · 1 comment
Closed

Why not use Build API of esbuild instead of Transform API? #9

AisonSu opened this issue May 26, 2022 · 1 comment

Comments

@AisonSu
Copy link

AisonSu commented May 26, 2022

sometimes people may need to have a programmatic usage, such as reading the ts file on the runtime,and in that time they will need to use some feature only the Build API support, like Inject. and it can easily run a way like transform by stdin and other opions.Just what i say in my PR of esbuild-register ,evanw said he may remove the transform api in the future and have people use build api instand(in this esbuild issue),so why we don't choose the powerful one?

if you agree i would contribute this feature.

@privatenumber
Copy link
Member

tsx is designed to enhance Node.js, instead of overriding behavior and delegating it to another program.

Using the esbuild build API would prevent Node.js features such as it's resolution algorithm, and being able to toggle it from working.

Besides, what you're describing sounds very simple to do via Bash pipe: esbuild ... | node

Not sure if I see the merit for it in a loader but if you want to abstract it into a Node.js module, you should consider a separate project for it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants