The understandably meant that the program failed to with node as
./import does not exist (
./import.js does). The error I reflected this
Error [ERR_MODULE_NOT_FOUND]: Cannot find module .../export' imported from ....
However, when testing with
jest, it works ‘correctly’ (as if the file extension was included). Does anyone know why this code is ‘correct’ for jest even though the file it is trying to import from does not really exist?
I have setup a very small repo here that replicates this issue (with the same configs). Hopefully this provides all full context regarding my issue.
When you run code in JEST, you are using JEST’s import system
Therefore the code likely is running correctly via JEST.
Does it list which extensions to try? e.g.
If so, that is your answer.