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
  • Merge requests
  • !10514

Convert invalid characters in SVG component name to ASCII

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/nvh95/file-transform into main Feb 05, 2021
  • Overview 2
  • Commits 2
  • Pipelines 0
  • Changes 3

Created by: nvh95

Fix #10513 If we import an SVG which filename contains some characters like @, react-scripts test will fail. For example logo@2x.svg. The reason is when packages/react-scripts/config/jest/fileTransform.js transforms logo@2x.svg to a component with the name of SvgLogo@2X. It is not a valid component name (or javascript variable).

I fix this by converting a character which is non-letter, non-number, non-underscore, into an ASCII number.

So logo@2x.svg will be transformed to SVGLogo642X instead of SvgLogo@2X, which is a valid component name

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/nvh95/file-transform