369d6b76c4
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 <diederik@digitalpatrol.nl> |
||
---|---|---|
.. | ||
asset-prefix | ||
base-path | ||
basic | ||
custom-resolver | ||
default | ||
image-from-node-modules | ||
no-intersection-observer-fallback | ||
noscript | ||
react-virtualized | ||
svgo-webpack | ||
trailing-slash | ||
typescript | ||
unicode | ||
unoptimized |