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

feat: added TypeScript + ts-node/esm and tsx/esm examples #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Jan 21, 2024

I noticed there wasn't yet an example that shows TypeScript transpilation on-the-fly with ESM imports/loaders. mochajs/mocha#5002 is a Mocha issue asking about support.

This adds two examples:

  • --import=tsx/esm: Newer --import flag for Node.js post-v18.19.0/v20.6.0
  • --loader=ts-node/esm: Older --loader flag for Node.js

Fixes #75

@JoshuaKGoldberg JoshuaKGoldberg changed the title feat: added TypeScript + ts-node/esm example feat: added TypeScript + ts-node/esm and tsx/esm examples Jan 21, 2024
FoxxMD added a commit to FoxxMD/multi-scrobbler that referenced this pull request Feb 15, 2024
So that we can use tsx with official --import rather than requiring (old-style) which doesn't work with string-sameness esm for some reason

mochajs/mocha#5002
mochajs/mocha-examples#76
@randre70
Copy link

tsx uses esbuild which doesn't support decorators. Whenever you have decorators in your code, don't use tsx/esbuild

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

Successfully merging this pull request may close these issues.

🚀 Feature: Add examples for more modern on-the-fly transpilation tools
2 participants