Making Next.js loves my custom conditional exports

Hello 👋, I'm trying to fiddle with the Next.js webpack config to have the resolution follow my custom condition in package.json#exports. Normally with webpack it would be as simple as putting the value in config.resolve.conditionNames, but it doesn't seem to work, my package is still not resolved. Does anyone has experience with this? The goal is to be able to load another package from my monorepo, I use the custom condition to point to the TS entry file instead of the dist one in dev. 👍 I'm already using transpilePackages.
1 Reply
jgoux
jgouxOP2y ago
Who is the Next.js OG in here? 😅 here is what the exports map looks like in the package I'm trying to import:
"exports": {
".": {
"snaplet_development": "./src/index.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"exports": {
".": {
"snaplet_development": "./src/index.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
(the condition I'm trying to match is snaplet_development) The only tips I found are here: https://github.com/vercel/next.js/discussions/33813 But none are working.
Want results from more Discord servers?
Add your server