You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Docusaurus v3.4] index.html in static directory raises "Multiple assets emit different content to the same filename" error #10198
Not a bug. We build to HTML pages. You cannot have an index.html file in static because we output a root index file. This is expected (and frankly required) behaviour. We have to output some kind of built index page to handle the scaffolding/app loading/container/routing. Even if you don't explicitly make one - we still have to write one for that purpose
Not a bug. We build to HTML pages. You cannot have an index.html file in static because we output a root index file. This is expected (and frankly required) behavior. We have to output some kind of built index page to handle the scaffolding/app loading/container/routing. Even if you don't explicitly make one - we still have to write one for that purpose
Understood, this is however a recent behavior as we have had a site since Docusaurus v2 and have handled the index page this way up until this version. We will look into swapping our approach if this is now expected.
Edit: A docusaurus build will also not throw this error, but instead links to / will throw a broken link error instead.
However, in the navbar config you can set like such do avoid the broken links:
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */({// Replace with your project's social cardimage: 'img/docusaurus-social-card.jpg',navbar: {title: 'My Site',logo: {alt: 'My Site Logo',src: 'img/logo.svg',href: "pathname:///"},
Using the pathname protocol will allow you to correctly be redirected back to the index.html
Afaik this file is served from memory when using the dev server.
We could probably do something but I'm not sure what makes sense. Do you expect Docusaurus dev server to start on http://localhost:3000/docs/myDoc for example?
I'm surprised this ever worked in v2. This behavior probably broke a long time ago already.
We could probably do something but I'm not sure what makes sense. Do you expect Docusaurus dev server to start on http://localhost:3000/docs/myDoc for example?
I'm surprised this ever worked in v2. This behavior probably broke a long time ago already.
For additional context, this remains working on Docusaurus version 3.3.2, which is the version our site is currently running. Upon upgrading to the next version, 3.4, is where you begin to experience this failure.
Hmmm. If you don't have a pages/index.tsx, I don't think we would emit build/index.html, so there shouldn't be duplicate assets.
I was also in this mindset of thinking, that the index.html file should just work (like previously) if there is not a pages/index.tsx file.
Activity
homotechsual commentedon Jun 5, 2024
Not a bug. We build to HTML pages. You cannot have an
index.htmlfile instaticbecause we output a root index file. This is expected (and frankly required) behaviour. We have to output some kind of built index page to handle the scaffolding/app loading/container/routing. Even if you don't explicitly make one - we still have to write one for that purposeDevon-White commentedon Jun 5, 2024
Understood, this is however a recent behavior as we have had a site since Docusaurus v2 and have handled the index page this way up until this version. We will look into swapping our approach if this is now expected.
Edit: A
docusaurus buildwill also not throw this error, but instead links to/will throw a broken link error instead.However, in the navbar config you can set like such do avoid the broken links:
Using the
pathnameprotocol will allow you to correctly be redirected back to theindex.htmlNow the build will complete, and all links work.
Josh-Cena commentedon Jul 18, 2024
Hmmm. If you don't have a
pages/index.tsx, I don't think we would emitbuild/index.html, so there shouldn't be duplicate assets.slorber commentedon Jul 19, 2024
During
docusaurus startthis is normal because we don't use SSR and we have to build/serve an initial entrypoint that is by defaultindex.htmlhttps://webpack.js.org/plugins/html-webpack-plugin/
Afaik this file is served from memory when using the dev server.
We could probably do something but I'm not sure what makes sense. Do you expect Docusaurus dev server to start on
http://localhost:3000/docs/myDocfor example?I'm surprised this ever worked in v2. This behavior probably broke a long time ago already.
Maybe we could generate a random index name, and use this in
devServer.historyApiFallback?Devon-White commentedon Jul 29, 2024
For additional context, this remains working on Docusaurus version
3.3.2, which is the version our site is currently running. Upon upgrading to the next version,3.4, is where you begin to experience this failure.I was also in this mindset of thinking, that the
index.htmlfile should just work (like previously) if there is not apages/index.tsxfile.I'm not sure what the best solution here would be, but this feels like it would make sense.
Josmithr commentedon Oct 11, 2024
I am encountering this issue as well. Any help finding a solution to this would be very helpful.
DanRoscigno commentedon Apr 25, 2025
Same here. Worked fine with 3.1, I upgraded to 3.7 and see this in dev mode.
gesslar commentedon Feb 1, 2026
Still here in 3.9.2 :/