Copy images in `docs` directory into production build
See original GitHub issue🐛 Bug Report
When a markdown file refers to an image in the current directory, it will render correctly when the dev server is running. However, the production build will not include the image (they are not copied from docs
to build
).
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
Add an image to the docs
directory and reference it from a markdown file:
My image:
![](image1.png)
Under the dev server, image1.png
will show up. But in a production build it will be a broken link.
Expected behavior
I would expect image1.png
to show up at build\docs\image1.png
.
Actual Behavior
The image does not appear and the link is broken in the rendered markdown.
Your Environment
Windows 10, running node 14, with docusaurus 2.0.0-alpha.56.
Reproducible Demo
The repo at https://github.com/jbaileyashe/docusaurus-bug demonstrates the problem. The file docs\bug.md
refers to an image in that directory (bug.png
).
Under the development server (npm run start
), the image shows up:
However, the production build will not include bug.png
. After npm run build
, running serve -s build -l 3000
(which serves those files through a simple webserver), you can see that the image is missing:
I checked in the build
directory. Looking in build\docs\bug
, there is no bug.png
, even though index.html
in that directory refers to it.
Ideally, bug.png
would get copied to build\docs\bug
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:17 (1 by maintainers)
Top GitHub Comments
I think there is a plugin or configuration problem. When I try that, I get a compilation error:
If that worked though, it’d be a totally acceptable solution.
Hey all, this is feature is now released! If you like it, don’t forget to retweet 😄 https://twitter.com/docusaurus/status/1286715187983048704