[Webpack] Error: Multiple chunks emit assets to the same filename

Hello, recently I updated to NextJS 15 and after that I started getting these webpack error which says:
Error: Conflict: Multiple chunks emit assets to the same filename /vercel/path0/public/image_name.webp

This does not happen locally, only in when code is pushed and Vercel builds it. I am using Fuma docs and the images are used there in md files. This has never been an issue until the next version update. Any ideas what I can do?

I tried adding this rule to the webpack config in next.config.mjs but didnt help either.

generator: {
   filename: 'static/media/[name].[hash][ext]', 
},

Update 1:
When I override the build command in settings to npm run build --turbopack now it builds fine, however when I try to visit an auth-gated page, it bricks with internal server error.

Update 2:
I fixed it by excluding the public folder from webpack config rules exclude: /public[\\/]/
Created a fuma remarkImage config and used it in nextjs config

import { remarkImage } from 'fumadocs-core/mdx-plugins';

/** @type {import('fumadocs-mdx').DocsConfig} */
const fumaConfig = {
  remarkPlugins: [
    [remarkImage, { useImport: false }],
  ],
};

export default fumaConfig;

This got rid of the errors but then i got build error again on Vercel, saying sharp is missing. And then I elusively installed it. npm i sharp

Comment:
This community page is real dead and working like support email replacement. GitHub Discussions were better.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.