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
SVG files imported as ReactComponent result in unused files in build/static/media and corresponding entries in build/precache-manifest.*.js.
When SVGs are loaded as a component, it is probably never desirable to have these files built so they should be omitted to reduce build size.
Steps to reproduce
# create minimal app that loads a SVG component
npx create-react-app svgtest
cd svgtest
echo'import {ReactComponent as logo} from "./logo.svg"'> src/index.js
yarn build
# see presence of SVGs in build files
ls build/static/media
cat build/precache-manifest.*.js
Notes
It's probably best to mark their a removal as a breaking change in case people rely on those files being present. Upgrade instructions should mention that SVG files are only built when they are loaded like a regular image, e.g. import logo from "./logo.svg".
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
Describe the bug
SVG files imported as
ReactComponent
result in unused files inbuild/static/media
and corresponding entries inbuild/precache-manifest.*.js
.When SVGs are loaded as a component, it is probably never desirable to have these files built so they should be omitted to reduce build size.
Steps to reproduce
Notes
It's probably best to mark their a removal as a breaking change in case people rely on those files being present. Upgrade instructions should mention that SVG files are only built when they are loaded like a regular image, e.g.
import logo from "./logo.svg"
.The text was updated successfully, but these errors were encountered: