-
Notifications
You must be signed in to change notification settings - Fork 36
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
add "edge-light" exports condition #263
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,11 @@ export default defineConfig((options) => { | |
entry: { | ||
[output]: input, | ||
}, | ||
footer(ctx) { | ||
return { | ||
js: ctx.format === 'esm' ? `export const built_for_${env} = true;` : `exports.built_for_${env} = true;` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I'm understanding the significance of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes the SSR and Browser bundle have the same shape, so I'm deliberately giving them different shapes by adding an additional environment-specific export, so I can safely distinguish between them in the Especially for the |
||
} | ||
}, | ||
}; | ||
} | ||
|
||
|
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.
This is the order of conditions that Next.js is using, so we check for that explicitly.
See
https://github.com/vercel/next.js/blob/bbd79ac9977e03010e09ff90d933f2ec614b031f/packages/next/src/build/webpack-config.ts#L96-L103