Using MDX and building for production outputs both optimized and original image assets #10066
Closed
1 task done
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
feat: assets
Related to the Assets feature (scope)
pkg: mdx
Issues pertaining to `@astrojs/mdx` integration
What version of
starlight
are you using?0.17.1
What version of
astro
are you using?4.2.6
What package manager are you using?
yarn 1.x
What operating system are you using?
macOS 14.3
What browser are you using?
Not browser specific
Describe the Bug
When the documentation is in "plain" Markdown files
.md
then the images get optimized and copied out intodist/_astro
.As soon as we renamed all the documentation files to
.mdx
(was a necessity, needed to use Astro/Starlight components), building for production yields both optimized and original assets. Specifically, am talking about images placed insrc/assets
(those inpublic
are IIUC not optimized anyway).To repro, simply create a new project, add a
.png
image to assets and reference it from a.md
file and thenbuild
- you should get a single.webp
image. Renaming to.mdx
and changing nothing else, will yield the same screenshot being output twice - once as.webp
and once as.png
(renamed, but otherwise identical).Yes, I am aware that I could post-process the build result and remove the
.png
files from the output, but it's not in the spirit of this project IMO where the tooling is so good and nothing needs silly tweaking.Important: was unable to figure out how to add an image to StackBlitz, the repro needs a single
Screenshot.png
in the assets folder.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-bwwxgj-kxfzr1?file=src%2Fcontent%2Fdocs%2Freference%2Fcool.mdx
Participation
The text was updated successfully, but these errors were encountered: