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

Cannot set config "extension:{ts: 'ts-node/esm'}" #271

Open
KermanX opened this issue Jan 31, 2022 · 8 comments
Open

Cannot set config "extension:{ts: 'ts-node/esm'}" #271

KermanX opened this issue Jan 31, 2022 · 8 comments

Comments

@KermanX
Copy link

KermanX commented Jan 31, 2022

Cannot set config as

  extensions: {
...
    ts: 'ts-node/esm'
  },

If I set it like this, it shows:
image

@KermanX
Copy link
Author

KermanX commented Feb 3, 2022

Hello?

@bjornstar
Copy link
Collaborator

Looks like you don't have ts-node installed.

@KermanX
Copy link
Author

KermanX commented Feb 3, 2022

Looks like you don't have ts-node installed.

I dont think so...

@KermanX
Copy link
Author

KermanX commented Feb 3, 2022

require(resolve(mod, { basedir }));

↑ this line use require whether it is MJS or CJS. I wonder whether it is correct. @bjornstar

@bjornstar
Copy link
Collaborator

Feel free to raise a PR with the fix.

@KermanX
Copy link
Author

KermanX commented Feb 3, 2022

I have no ideas 😥

@KermanX
Copy link
Author

KermanX commented Feb 3, 2022

I tried to use import, but got more errors...
And I've learnt TS/JS for only 0.5 years...

@kherock
Copy link
Contributor

kherock commented Mar 27, 2022

This is actually a duplicate of #242. From ts-node's docs, their ESM loader must passed as a custom loader:

Use any of:
ts-node --esm
ts-node-esm
Set "esm": true in tsconfig.json
node --loader ts-node/esm
NODE_OPTIONS="--loader ts-node/esm" node

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

No branches or pull requests

3 participants