The knowledge sources do not explicitly mention a way to prevent Astro from keeping a copy of dynamically imported SVG files in the dist/_astro directory while also inlining them.
Based on the provided documentation, here is what is known about the behavior of SVG components in Astro:
Default Behavior
Starting in astro@5.7.0, Astro allows you to import SVG files as components and will inline the content directly into your HTML output [SVG components]. This feature was previously introduced as an experimental flag in astro@5.0.0 [Experimental SVG components].
Handling Redundancy
The documentation does not provide a specific configuration to suppress the physical file generation in dist/_astro when an SVG is used as a component. However, there are two modes available for handling SVGs if you are using the experimental flag or specific versions of the feature:
inline (Default): Astro inlines the SVG content into your HTML output [Experimental SVG components].
sprite: Astro generates a sprite sheet for all imported SVG files instead of inlining them individually. You can set this globally in your config or per component using the mode attribute:<Icon mode="sprite" />
This may consolidate the "redundant" individual files into a single sprite sheet, though it changes how the SVG is delivered to the browser [Experimental SVG components].