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

Is Bundle / Compile command planned? #540

Open
5 of 7 tasks
endel opened this issue May 3, 2024 · 1 comment
Open
5 of 7 tasks

Is Bundle / Compile command planned? #540

endel opened this issue May 3, 2024 · 1 comment
Labels
enhancement New feature or request pending triage

Comments

@endel
Copy link

endel commented May 3, 2024

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I understand tsx aims for TypeScript parity and is not for arbitrary Node.js enhancements
  • This request cannot be made to Node.js directly, and is specific to tsx
  • I understand this form is not for addressing a bug or seeking help
  • I have read and understood the Contribution guide

Feature request

Allow bundling a Node.js app into JavaScript, so it can be executed later by node directly:

tsx bundle index.ts

Maybe some runtime configs could be lost on the final bundled file, but it may serve well in most use cases.

Motivations

Execute the final built .js file via node.

As tsx is capable of combining TypeScript configs and use esbuild under the hood, would it be viable to use tsconfig.json configuration (such as outDir) to generate a bundled .js output?

Alternatives

npx esbuild src/index.ts --bundle --platform=node --packages=external  > my-built-file.js

Additional context

No response

Contributions

  • I'm interested in working on this issue
  • I'm willing to offer financial support
@endel endel added enhancement New feature or request pending triage labels May 3, 2024
@privatenumber
Copy link
Owner

Thanks for the request!

Bundling is out of scope for tsx, but I have pkgroll for that which is more tailored for bundling: https://github.com/privatenumber/pkgroll

This is how tsx uses it (how to bundle is inferred from package.json):

"build": "pkgroll --minify",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pending triage
Projects
None yet
Development

No branches or pull requests

2 participants