question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `esm` to `ts-node` flags

See original GitHub issue

I’m trying to run

ts-node-dev --experimental-specifier-resolution=node --esm --transpile-only src/index.ts

I’m getting this message

bad option: --esm

https://github.com/wclr/ts-node-dev/blob/32bdc92458a59f66bcbd36e87de2a793f529a825/src/bin.ts#L11

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DesignByOnyxcommented, Dec 9, 2022

I was able to get it working with ts-node and nodemon. I can’t yet speak for the speed, but it works:

npm i typescript ts-node nodemon -D

# this one worked first
nodemon -I --exec node --experimental-specifier-resolution=node  --loader ts-node/esm ./src/main.ts

# but then I got this one to work, a bit shorter and easier to read IMO
nodemon --exec node --loader ts-node/esm  ./src/main.ts

This was taken from this thread: https://github.com/wclr/ts-node-dev/issues/314

1reaction
wclrcommented, Jun 10, 2022

Cannot find module ‘esm’

Install esm loader package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration | ts-node - TypeStrong · GitHub
Configuration. ts-node supports a variety of options which can be specified via tsconfig.json , as CLI flags, as environment variables, or programmatically.
Read more >
ts-node - npm
ts -node is a TypeScript execution engine and REPL for Node.js. It JIT transforms TypeScript into JavaScript, enabling you to directly execute ...
Read more >
How to add --project flag to ts-node/register? #869 - GitHub
I want to compile ts-node with tsconfig.server.json instead of tsconfig.json . tsconfig.json is a default config for ts-node but server.ts needs ...
Read more >
Getting Started with Executing TypeScript files in ts-node
Learn how to execute TypeScript Javascript files in ts-node but ... Run the following bash command to add the NodeSource PPA to your...
Read more >
How To Run TypeScript Scripts with ts-node - DigitalOcean
With TypeScript being a superset of JavaScript, using it means compiling your TypeScript files down to pure JavaScript before the V8 engine can ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found