-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow image-pool to be used as its own Worker #5317
Conversation
🦋 Changeset detectedLatest commit: 328881f The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Is there specific about the hosted SSR environments that allowed @astrojs/image to work in our SSR tests and locally with the node adapter but break in Netlify/Vercel? Or are the existing SSR tests broken?
!preview vercel-image |
|
!preview vercel-image |
|
@tony-sull The problem is because of this line:
It's not able to find that file to launch as a worker. I'm not 100% sure why; my guess would be that the cwd is not relative to node_modules perhaps. For Vercel it might be inside of their The fix is to make image-pool.js it's own separate bundle (chunk) and then launch itself as a worker instead, see here:
Here's a demo app example
|
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.
Excellent fix!
Really interesting to see that the build output ends up in different locations in the hosted build, not sure the right way to test that as part of our CI 🤔
* Allow image-pool to be used as its own Worker * Adding a changeset * fix image tests * update picture tests * Pass the current URL
Changes
import.meta.url
. This makes it work correctly when bundled for SSR.Testing
@astrojs/node
@astrojs/vercel/serverless
.Docs
N/A, bug fix