The nextjs docs (https://nextjs.org/docs/basic-features/static-file-serving) state to add image file paths under the public
directory.
I have a component that renders an image component and the file renders correctly on my nextjs project but doesn't render inside of storybook. The image file is currently living in public/images/
const renderImage = () => {
const portraitClassName = cx({
[styles.imageContainerPortrait]: true,
});
return (
<img
className={portraitClassName}
data-testid="image"
src="/images/portrait.png"
alt={image.imgAlt}
/>
);
};
This is my current config file for storybook
webpackFinal: async (config) => {
config.module.rules.push({
test: /\.(scss|sass|css)$/,
use: [
{
loader: "sass-loader",
options: {
implementation: require("sass"),
},
},
{
loader: "postcss-loader",
options: {
ident: "postcss",
plugins: [tailwindcss, autoprefixer],
},
}
],
include: path.resolve(__dirname, "../"),
});
return config;
}
Is there something missing that would allow me to render images in the same manner as how Nextjs is set up?