Closed maximeSurmontGH closed 2 years ago
Hey @maximeSurmontGH
Since currently Jest does not support ESM (https://stackoverflow.com/a/62210156/7599734), you can bypass this issue importing the module as so: import { MorpheusModule } from 'morpheus4j/dist/nest';
Oh ! Just tried and ran into this error :
Error: Package subpath './dist/nest' is not defined by "exports" in /Users/maximesurmontlcdm/Documents/LCDM/agriflux-app/server/node_modules/morpheus4j/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
I "fixed it" locally by adding :
// morpheus4j's package.json
{
// ...
"exports": {
// ...
"./dist/nest": "./dist/nest/index.js",
}
}
I also tried to run jest with their experimental ESM support but no change 😭
Do you mind cloning and checking if this repo works for you? https://github.com/marianozunino/morpheus-e2e-bug
Either way, I changed the default export to be Nest's module. Since there is no reason to export the other functions. So, now you should be able to import the module just using :
import { MorpheusModule } from 'morpheus4j';
Works well thx 🙏
Me again :)
I m just trying to implement e2e tests and I run into this error :
Do you have any idea where it can come from ? I can provide a repo with this error reproducted, or just do :