deepkit-framework: Module resolution errors
I have a NextJs app inside a monorepo. Pacakges are built using Nx
package.json
"dependencies": {
"@deepkit/type": "^1.0.1-alpha.58",
[...]
}
Yarn install log
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @deepkit/type@1.0.1-alpha.58" has unmet peer dependency "@deepkit/core@^1.0.1-alpha.13".
warning " > @deepkit/type@1.0.1-alpha.58" has unmet peer dependency "reflect-metadata@^0.1.13".
[...]
I try to build
nx build
I get
../../node_modules/@deepkit/type/dist/esm/src/decorators.js
Module not found: Can't resolve '@deepkit/core' in '[path-omitted]\node_modules\@deepkit\type\dist\esm\src'
Looking at the yarn log, I then see that It’s messing a peer dependency to “@deepkit/core@^1.0.1-alpha.13” “reflect-metadata”: “^0.1.13”
So I added those.
Then the build error becomes
Cannot find module '[path-omitted]\node_modules\@deepkit\type\dist\esm\src\types' imported from [path-omitted]\node_modules\@deepkit\type\dist\esm\index.js
Any ideas?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (7 by maintainers)
TypeScript’s compiler does not support Node’s default ESM resolution algorithm. They have introduced it in version 4.5 beta https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#esm-nodejs, but dropped it in the final 4.5 due to issues. To enable the commonly used module resolution algorithm you have to pass to node
--experimental-specifier-resolution=node. You can also configure that in your environment variableNODE_OPTIONS=--experimental-specifier-resolution=node. If nextjs supports passing custom node arguments, you can configure it there.