Using dynamic import of ESM library yields "Cannot find module" #3748
Unanswered
joaorodrigues-consensys
asked this question in
Q&A
Replies: 1 comment
-
fixed here: #3749 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, we've got a statement in the code of a dynamic import of an ESM package:
This code runs well at runtime (i.e.: application running) and the module is correctly imported.
However, it fails when running jest:
Is there any settings I need to enable so that ts-jest imports the library correctly?
I've got a very simple repo to reproduce this issue. It's a plain nestjs project with a controller that dynamically imports the library:
npm run start
&&curl http://localhost:6556
runs through controller code, loads the library and returns a valid valuenpm run test
fails withCannot find module '@lodestar/params' or its corresponding type declarations.
Beta Was this translation helpful? Give feedback.
All reactions