ts-node: ts-node and ts-node-dev don't work with `cannot read property of undefined` for everything locally imported.
But tsc && node -r esm .
and nodemon -e ts -x 'tsc && node -r esm .'
works OK.
Everything that I locally imported seems to be undefined with ts-node
and I have tried madge
and detect-circular-deps
and they could not find a problem…
Real project – https://github.com/patarapolw/rep2recall-web/blob/91e6f6a5870dca52010b4e569d4bb81f7c5be78f/package.json#L92 and https://github.com/patarapolw/rep2recall-web/blob/master/src/backend/server.ts
Might be exactly the same issue as https://github.com/TypeStrong/ts-node/issues/819
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18
@cspotcode I tried also the same scenario without the package.json field
type
set to module and removed theesm
requirement,esm
and module set toesnext
. Errors out since it can’t understandimport
statementsesm
and module set tocommonjs
. Returns the value as expected with or without the path mappings.If we get a minimal reproduction, we can identify the root cause.