I am developing components with Playroom for use in a Next.js application. Right now, I am trying to figure out how to configure Webpack to resolve the following inconsistency:
I use Next.js for my application, so I need to write
<img src="/image.jpeg">andbackground-image: url("/image.jpeg")to display an image stored atpublic/image.jpegrelative to the project root. (reference to docs on this)However, Playroom appears to resolve
<img>srcpaths andbackground-image: url(...)paths from the root of the project. I need to use either<img src="public/image.jpeg"/>orbackground-image: url('public/image.jpeg')to display the image stored atpublic/image.jpegThis makes the paths for my images in the Playroom environment incompatible with the paths that images need to resolve properly in the Next.js environment.
Ideally, I would like all image paths starting with / to resolve to paths starting with /public in the Playroom environment. For example, /image.jpeg would resolve to /public/image.jpeg
Playroom exposes an option for providing custom webpack config. How can I use this config to accomplish the above behavior, and resolve this issue?