-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix: server islands regression in bundling #11702
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixes a regression where an emitted hashed file contained characters that aren't allowed in some hosting platforms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@matthewp what was the reason for adding the entry point to the list of inputs?
If there's a valid reason, I can restore this change, but it has be done in a different way. We would have to create a virtual module
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.
So that the adapter will be built to a separate module and get executed as one of the first things. With the addition of using
crypto
we need the Node adapter to run early because it polyfills in Node 18. Without this the adapter will be inlined into this main module and not execute in time. Here's the scenario:This throws. because an imported dependency executes first. With this change however:
This now works, because the adapter bundle is the first thing to execute, allowing it to polyfill anything it needs to.
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.
Isn't it just us that uses
globalThis.crypto
? Could we ponyfill it ourselves at the point of use instead of relying on a global polyfill?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.
Not easily, no, you need to import
node:crypto
which doesn't work in non-Node environments.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.
Only if
globalThis.crypto
isn't defined, which it would be on those runtimesThere 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.
Not sure I follow,
globalThis.crypto
is defined in ever environment (to my knowledge) other than Node 18. How would you suggest importing it without it causing bugs when Cloudflare / Deno do their bundling?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 meant externalising it and importing it dynamically if it's undefined. Deno is fine because it supports
node:crypto
anyway. I don't know enough about how bundling works for Cloudflare to say if it would work.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.
So we understand each other, what you're suggesting is this, right?
I'm pretty sure the bundle step for Cloudflare will complain about this. We could hide it or add an ignore comment or something possibly.
Part of my stubbornness here is that this is a correctness thing, the adapters are supposed to run first in order to polyfill the environment if they need to. In the past there was more of a need to do this as there was less alignment on globals. Today it's not the case as much as
crypto
is the only thing I'm aware 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.
Yeah, basically. That makes sense. I think the real fix here is to work out why rollup is unhappy with Netlify's entrypoint being external