-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Imageloader: collect images serverside to include images from staticp… (
#41554) In #41548, I show that I would like to provide an object with images in getStaticProps. The StaticImageData is parsed correctly and provided as a prop to the page. Nonetheless, the image is not available in the static directory. Therefore the image is not shown. This is also addressed in issue #29571. The underlying cause is that the import of the image is removed from the client bundle and only present in the server bundle. Evaluating the next-image-loader shows that the file is only placed in the static directory if emitted from the client bundle by firing this.emitFile. By changing this to only emitting the file from the serverside bundle in the webpackloader, static images loaded in the getStaticProps are made available properly as well as images directly used in componts (so present in server and client bundle). This would PR would prevent the circumventing solution which enforces that the StaticImageData should be present in the client side bundle while it will also be present in the staticprops. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` Closes #42783, Fixes #42443 Co-authored-by: Diederik <[email protected]>
- Loading branch information
Showing
6 changed files
with
87 additions
and
5 deletions.
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
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
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