-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
next build
fails on importing a packaging via its conditional export
#43698
Comments
Possible duplicate of #39375? |
I managed to get the MVE working by adding npm install
cd next-app
npm run build
npm run start The problem is with
If we remove |
When we run I experimented a bit more and managed to get rid of "exports": {
".": {
"import": "./src/index.ts"
},
"./alt": {
"import": "./src/index-alt.ts"
},
"./package.json": "./package.json"
},
"main": "./src/index.ts",
"typesVersions": {
"*": {
"alt": ["src/index-alt.ts"]
}
} Ideally, it’d be great to see this working in some future version of TypeScript: "exports": {
".": {
"import": "./src/index.ts",
"types": "./src/index.ts"
},
"./alt": {
"import": "./src/index-alt.ts",
"types": "./src/index-alt.ts"
},
"./package.json": "./package.json"
}, That’s not the case yet. |
Looks fairly similar, I did a search but didn't find it, thanks!
I'm also seeing that, even though I could have sworn I checked multiple times that tsc was passing without complaint but perhaps I'm getting my wires crossed. I'll close off this issue because I agree with your assessment that this is probably a problem elsewhere. Thanks! |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
❯ next info
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
https://stackblitz.com/edit/vercel-next-js-r1qnjk?file=next-app/pages/index.tsx
To Reproduce
next dev
and see it succeedsnext build
and see it failDescribe the Bug
From my testing,
next build
doesn't seem to support importing from package's conditional imports. Weirdlynext dev
runs successfully, but when you runnext dev
you get errors about how the package can't be found:Expected Behavior
I would expect
next build
to be able to resolve the entrypoint likenext dev
does.Which browser are you using? (if relevant)
Chrome 107.0.5304.110
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: