docusaurus: Asset in /static is duplicated in /build (with/without hash)
π₯ Proposal
Docusaurus transfers all the files under static
directory to root build directory. Additionally, images, PDFs linked using markdown syntax are processed (files names are suffixed with a hash) and placed under images
, files
etc. and these are actually linked. So there are two copies of those files. I guess this is not ideal, and probably there should be better build rules to avoid these duplicates.
However, the above is not true for every file, for example, the favicon
in the doucsaurus.config.js
is not given hashed filename, neither the files linked using JSX baseUrl. In this case, the website links them to the ones transferred from the static
directory.
Have you read the Contributing Guidelines on issues?
Yes.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (9 by maintainers)
Going to close this as working as intended. If you donβt want the asset to appear in
/assets
, you can usepathname:///file.pdf
, which will also be rendered as an external link that opens a new tab.I ran into this same issue of two copies of the file. In my case, I have a
page
referencing a pdf file. Instead of putting the pdf in static directory I put it inpages/assets
directory and referenced it in the page.md as(pdf)[./assets/pdf.pdf]
. With this, it just created a file in build/assets/files/pdf-[hash].pdfThank you for the details.