[NEXT-779] next/* - Typescript cannot find module when moduleResolution=nodenext and type=module
### Verify canary release - [X] I verified that the issue exists in the latest Next.js canary release ### Provide environment information Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000 Binaries: Node: 16.17.0 npm: 8.15.0 Yarn: N/A pnpm: 7.25.0 Relevant packages: next: 13.1.7-canary.18 eslint-config-next: 13.0.0 react: 18.2.0 react-dom: 18.2.0 ### Which area(s) of Next.js are affected? (leave empty if unsure) TypeScript ### To Reproduce - `pnpm create next-app` (with typescript) - add `"type": "module"` to `package.json` - change `moduleResolution` to `nodenext` - run `npx tsc --noEmit` ### Describe the Bug Typescript complain about `next/*`, for example: > Cannot find module 'next/head' or its corresponding type declarations. I believe this is because there is no `exports` field in `node_modules/next/package.json`. ### Expected Behavior Typescript shouldn't complain. # Context - We use `"type": "module"` as we want repo scripts to be esm rather than cjs. - We use `"moduleResolution": "nodenext"` as we use a setup similar to the monorepo created by `npx create-turbo@latest`, but we want sources to be under `src` and not the root folder. ### Which browser are you using? (if relevant) _No response_ ### How are you deploying your application? (if relevant) _No response_ <su
Posted by Izhaki on Feb 18, 2023, 12:38 AM
Tags
Related issues
- Qt is fully of bugs on Wayland, some of which are unfixable because the API makes guarantees that are impossible to uphold.
- I took the plunge into GrapheneOS a week ago.
- [FEATURE] Multi-device Cowork: Allow concurrent Cowork agents on multiple machines under a single account
- [BUG] Claude Desktop spawns 1.8 GB Hyper-V VM on every launch, even for chat-only use
- Those cheap Bluetooth Tesla coils on AliExpress use A2DP audio as their control signal - a comparator converts the audio into spark pulses.
- [Prisma 7.0.0] TypeScript TS2742 errors with pnpm monorepo - cannot resolve @prisma/client-runtime-utils types
Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments
onboarding (SaaS)
Qt is fully of bugs on Wayland, some of which are unfixable because the API makes guarantees that are impossible to uphold.
I took the plunge into GrapheneOS a week ago.
[FEATURE] Multi-device Cowork: Allow concurrent Cowork agents on multiple machines under a single account
[BUG] Claude Desktop spawns 1.8 GB Hyper-V VM on every launch, even for chat-only use
Those cheap Bluetooth Tesla coils on AliExpress use A2DP audio as their control signal - a comparator converts the audio into spark pulses.
[Prisma 7.0.0] TypeScript TS2742 errors with pnpm monorepo - cannot resolve @prisma/client-runtime-utils types
I built a routine management app for my kids (7 and 10) called "Oh Yah!" after their constant "Oh yah!
> If it is open source, then I can build and install it myself.
[NEXT-779] next/* - Typescript cannot find module when moduleResolution=nodenext and type=module
### Verify canary release - [X] I verified that the issue exists in the latest Next.js canary release ### Provide environment information Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000 Binaries: Node: 16.17.0 npm: 8.15.0 Yarn: N/A pnpm: 7.25.0 Relevant packages: next: 13.1.7-canary.18 eslint-config-next: 13.0.0 react: 18.2.0 react-dom: 18.2.0 ### Which area(s) of Next.js are affected? (leave empty if unsure) TypeScript ### To Reproduce - `pnpm create next-app` (with typescript) - add `"type": "module"` to `package.json` - change `moduleResolution` to `nodenext` - run `npx tsc --noEmit` ### Describe the Bug Typescript complain about `next/*`, for example: > Cannot find module 'next/head' or its corresponding type declarations. I believe this is because there is no `exports` field in `node_modules/next/package.json`. ### Expected Behavior Typescript shouldn't complain. # Context - We use `"type": "module"` as we want repo scripts to be esm rather than cjs. - We use `"moduleResolution": "nodenext"` as we use a setup similar to the monorepo created by `npx create-turbo@latest`, but we want sources to be under `src` and not the root folder. ### Which browser are you using? (if relevant) _No response_ ### How are you deploying your application? (if relevant) _No response_ <su
Comments (0)
No comments yet. Start the discussion.