Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #9167
Closed
Open
Issue created Jun 16, 2020 by Administrator@rootContributor

SVG files imported as React components should not end up in build directory

Created by: dominique-mueller

Intro

SVG files can be imported as React component, and thus inlined into the bundle, using the following syntax:

import { ReactComponent as MySvg } from '../../assets/icons/my-svg.svg'

Actual behaviour

Although inlined, the original SVG files will still be processed (by Webpack?) and end up

  • in the build/static/media folder
  • in the asset-manifest.json file

Overall, this isn't critical - it only means that unused files end up in the build folder. Nevertheless, it's a very confusing behaviour, developers might assume those files are being used or even that SVGs imported the way described above are not being inlined.

Expected behaviour

The expected behaviour is that inlined resources do not end up in the build folder, resulting in a smaller and clean build folder.

Related

  • Follow up on https://github.com/facebook/create-react-app/issues/7941 which was marked as stale
  • Related to https://github.com/facebook/create-react-app/issues/9009
Assignee
Assign to
Time tracking