-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(nextjs): Replace multiplexer with conditional exports #11442
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
Conversation
@vercel/otel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow end of an era
"default": "./build/esm/edge/index.js" | ||
}, | ||
"workerd": { | ||
"default": "./build/esm/edge/index.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are always esm only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, in general I think nextjs can cope with only having esm but I'm gonna try to add cjs exports too.
"browser": { | ||
"import": "./build/esm/index.client.js", | ||
"require": "./build/cjs/index.client.js" | ||
}, | ||
"node": "./build/cjs/index.server.js", | ||
"import": "./build/esm/index.server.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lforst
I noticed in this PR that node
exports take precedence over import
. Is this expected? This causes the resolution to always fall back to the CommonJS version in a Node environment, regardless of whether ESM is used.
We can replace the SDK multiplexer with conditional exports. I found this while preparing the Next.js SDK for using
@vercel/otel
.This is preferrable over the current solution because the loaders will not work any longer with turbopack.