Closed as not planned
Description
Verify canary release
- 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 22.3.0: Thu Jan 5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000
Binaries:
Node: 18.12.0
npm: 8.19.2
Yarn: 1.22.19
pnpm: 7.26.1
Relevant packages:
next: 13.1.7-canary.0
eslint-config-next: 13.1.5
react: 18.2.0
react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
TypeScript
Link to the code that reproduces this issue
https://stackblitz.com/edit/vercel-next-js-fkhtk7?file=pages/index.tsx
To Reproduce
- Add a dependency on a package which has a conditional export entrypoint.
- Try and import via its conditional entrypoint path, while using "moduleResolution: node16"
- Run
next dev
and see it succeeds - Run
tsc --noEmit
and see it succeeds - Run
next build
and see it fails withType error: Cannot find module '...' or its corresponding type declarations.
Describe the Bug
This is probably a perfect clone of #43698 , however I think the issue is NOT on Typescript side.
The main difference with the other issue is that running tsc --noEmit
works perfectly, while using moduleResolution: node16
. It (correctly) fails while using moduleResolution: node
, since exports only work with node16/nodenext. next build
, however, always fails.
I saw #44177 merged in the latest canary, but while dev
works perfectly (and I'm able to use the components), build
compiles correctly but fails in type checking. Maybe something else is missing?
Expected Behavior
The build should work
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response