-
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
Conversation
"resetApolloSingletons", | ||
"built_for_ssr" | ||
], | ||
"edge-light,worker,browser": [ |
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
size-limit report 📦
|
Job #93: Bundle Size — 1.01MiB (0%).Warning Bundle contains 1 duplicate package – View duplicate packages Bundle metrics
|
Current Job #93 |
Baseline Job #92 |
|
---|---|---|
Initial JS | 890.59KiB |
890.59KiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 22.25% |
0.04% |
Chunks | 24 |
24 |
Assets | 45 |
45 |
Modules | 512 |
512 |
Duplicate Modules | 30 |
30 |
Duplicate Code | 1.29% |
1.29% |
Packages | 29 |
29 |
Duplicate Packages | 1 |
1 |
Bundle size by type no changes
Current Job #93 |
Baseline Job #92 |
|
---|---|---|
JS | 1023.85KiB |
1023.85KiB |
Other | 5.99KiB |
5.99KiB |
View job #93 report View pr/edge branch activity View project dashboard
/release:pr |
A new release has been made for this PR. You can install the package you need using one of
|
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.
Changes look good. I was mainly curious about what the bundle_for_x
was for 🙂
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'm understanding the significance of the build_for_<env>
variable here. Could you explain that?
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.
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 package-shape.json
test.
Especially for the edge-light
condition, I needed a way to safely distinguish between the SSR build and the Browser build, because they "looked the same".
I believe this should resolve #261 and #262.
I'm a bit hesitant to just slap a "worker" (which doesn't seem to be standardized?) on here, so I'm going for the more granular
"edge-light"