rsnext/packages/next/build/webpack
Laityned 369d6b76c4
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 <diederik@digitalpatrol.nl>
2022-11-23 09:28:53 -05:00
..
config Fix CSS handling rules (#42615) 2022-11-09 16:28:48 -08:00
loaders Imageloader: collect images serverside to include images from staticp… (#41554) 2022-11-23 09:28:53 -05:00
plugins Imageloader: collect images serverside to include images from staticp… (#41554) 2022-11-23 09:28:53 -05:00
require-hook.ts Bundle ssr client layer excepts react externals (#41606) 2022-10-22 16:33:51 -07:00
stringify-request.ts Update loader-utils (#30743) 2021-11-02 16:13:15 +01:00
utils.ts Improve type checking (#41427) 2022-10-19 18:28:36 +02:00