-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
How to translate the entire project directory? #263
Comments
This is a bundler, and it's intended use case is for bundling. So what you're asking for is not the intended use case. But I believe it should basically be possible. If you need to do that you could either:
|
@evanw Thank you, I thought so. Just confused by the slogan "Similar tools: Babel or TypeScript for transpiling". This is not entirely true, because "Cannot use" format "without" bundle "". I don't know why someone would need to bundle a single cjs file. Will have to return to sucrase |
Makes sense. Sorry about the confusion. Looks like this is a request for #109 then, so I'll close this as a duplicate. |
@evanw Referencing this community projects here : https://github.com/egoist/tsup as it seems to do what @makoven wanted and is built on top of esbuild and rollup. |
Just for reference. I use this to build my express server typescript files:
(server is an npm workspace/folder for the express server) |
|
If you are using yarn you will need to change to the following:
|
The more I look into this, the more complex it seems, and the less sure I am with both the way I have things now, as well as whether I like the other options instead. I think I may just stick with TSC for compiling my package code in general, and if anything I can still do/try out the dual-build setup with ESM/CJS, but maybe just use TSC, since I can ensure that things are built consistently. Should I provide synchronous APIs from NBTify? I think learning about how to work with async has really helped me progress, and I don't want to prevent someone else from learning that if I go with providing a sync option to my API. Or rather, if anything, that would only work in Node, because the Compression Streams API is only an asynchronous implementation. I'd have to use Node Zlib as a fallback to allow for a synchronous implementation, and it would be for Node only. I'm not sure I like the splintering of that either. I think I have realized afterall, that I don't specifically want to use ESBuild for building my packages, since it's meant to bundle code, and I think I would only want to use that in a situation of building an ESM bundle for the browser. I may look into that as well though. Maybe I can use pkgbuild for that instead though? It kind of works a bit nicer for plain TS type generation support out of the box, as well as the configuation for things just plain working. Maybe I can look into making my own tool kind of like that, since it feels like all of the tools for this that I find, they all don't quite work exactly like how I want them to, unfortunately. https://www.reddit.com/r/node/comments/14os7zv/the_esmcjs_situation/ https://github.com/wooorm/npm-esm-vs-cjs https://stackoverflow.com/questions/46515764/how-can-i-use-async-await-at-the-top-level https://stackoverflow.com/questions/71517624/because-i-cant-run-await-on-the-top-level-i-have-to-put-it-into-an-async-funct https://commerce.nearform.com/blog/2021/node-esm-and-exports/ https://dev.to/a0viedo/nodejs-typescript-and-esm-it-doesnt-have-to-be-painful-438e https://www.reddit.com/r/node/comments/14rg9ym/esm_not_gaining_traction_in_backend_node/ nodejs/node#49432 https://github.com/azu/tsconfig-to-dual-package https://www.breakp.dev/blog/simple-library-package-setup-with-esbuild/ https://esbuild.github.io/api/#build evanw/esbuild#263 evanw/esbuild#618 microsoft/TypeScript#46005 https://guitar.com/news/music-news/devin-townsend-shredding-dreams-steve-vai/ https://www.reddit.com/r/DevinTownsend/comments/17s332s/devin_and_the_vai_years/ https://www.reddit.com/r/DevinTownsend/comments/k9jot4/devin_townsend_i_was_unable_to_articulate_my/ https://www.kerrang.com/devin-townsend-i-was-unable-to-articulate-my-discontent-so-i-tended-to-act-up-i-even-took-a-sh-t-in-steve-vais-guitar-case https://www.reddit.com/r/DevinTownsend/comments/6tia0r/is_vai_comparing_devin_to_zappa/
The more I look into this, the more complex it seems, and the less sure I am with both the way I have things now, as well as whether I like the other options instead. I think I may just stick with TSC for compiling my package code in general, and if anything I can still do/try out the dual-build setup with ESM/CJS, but maybe just use TSC, since I can ensure that things are built consistently. Should I provide synchronous APIs from NBTify? I think learning about how to work with async has really helped me progress, and I don't want to prevent someone else from learning that if I go with providing a sync option to my API. Or rather, if anything, that would only work in Node, because the Compression Streams API is only an asynchronous implementation. I'd have to use Node Zlib as a fallback to allow for a synchronous implementation, and it would be for Node only. I'm not sure I like the splintering of that either. I think I have realized afterall, that I don't specifically want to use ESBuild for building my packages, since it's meant to bundle code, and I think I would only want to use that in a situation of building an ESM bundle for the browser. I may look into that as well though. Maybe I can use pkgbuild for that instead though? It kind of works a bit nicer for plain TS type generation support out of the box, as well as the configuation for things just plain working. Maybe I can look into making my own tool kind of like that, since it feels like all of the tools for this that I find, they all don't quite work exactly like how I want them to, unfortunately. https://www.reddit.com/r/node/comments/14os7zv/the_esmcjs_situation/ https://github.com/wooorm/npm-esm-vs-cjs https://stackoverflow.com/questions/46515764/how-can-i-use-async-await-at-the-top-level https://stackoverflow.com/questions/71517624/because-i-cant-run-await-on-the-top-level-i-have-to-put-it-into-an-async-funct https://commerce.nearform.com/blog/2021/node-esm-and-exports/ https://dev.to/a0viedo/nodejs-typescript-and-esm-it-doesnt-have-to-be-painful-438e https://www.reddit.com/r/node/comments/14rg9ym/esm_not_gaining_traction_in_backend_node/ nodejs/node#49432 https://github.com/azu/tsconfig-to-dual-package https://www.breakp.dev/blog/simple-library-package-setup-with-esbuild/ https://esbuild.github.io/api/#build evanw/esbuild#263 evanw/esbuild#618 microsoft/TypeScript#46005 https://guitar.com/news/music-news/devin-townsend-shredding-dreams-steve-vai/ https://www.reddit.com/r/DevinTownsend/comments/17s332s/devin_and_the_vai_years/ https://www.reddit.com/r/DevinTownsend/comments/k9jot4/devin_townsend_i_was_unable_to_articulate_my/ https://www.kerrang.com/devin-townsend-i-was-unable-to-articulate-my-discontent-so-i-tended-to-act-up-i-even-took-a-sh-t-in-steve-vais-guitar-case https://www.reddit.com/r/DevinTownsend/comments/6tia0r/is_vai_comparing_devin_to_zappa/
Sorry for the stupid question. Is it possible to use your utility to translate ALL project files from one format (ts/tsx), recursively, to a directory of js files with a similar structure, as does the typescript or babel?
The text was updated successfully, but these errors were encountered: