Skip to content

Conversation

nvh95
Copy link
Contributor

@nvh95 nvh95 commented Feb 5, 2021

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

@nvh95
Copy link
Contributor Author

nvh95 commented Feb 6, 2021

@ianschmitz @iansu @mrmckeb @petetnt I just update a test to cover this case. It's great if you guys can give me any feedback. Thanks.

@stale
Copy link

stale bot commented Jan 9, 2022

This pull request 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.

@stale stale bot added the stale label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test fails with @ in the SVG filename
2 participants