Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG files names beginning with a number cause an error in SVGO #61

Open
caesarsol opened this issue Jul 24, 2019 · 0 comments
Open

SVG files names beginning with a number cause an error in SVGO #61

caesarsol opened this issue Jul 24, 2019 · 0 comments
Labels

Comments

@caesarsol
Copy link
Contributor

For SVG imported like this:

import { ReactComponent as SvgIcon } from './123-abc.svg'

Webpack gives this error:

!!! Errors in compiling:

 • ./src/123-abc.svg
   TypeError: Cannot read property 'each' of undefined
       at Array.forEach (<anonymous>)
       at Array.forEach (<anonymous>)

The solution is start the SVG filename with a letter.

This is due to the SVGO plugin which has a bug prefixing CSS classes names with the filename, and CSS classes cannot begin with a number. @ilariaventurini is filing an issue (and a fix) on SVGO repo right now! Both for the non-meaningful error of numeric classes, and for the filename-prefixing code.
Then we should alert the SVGR team, and then update accurapp's SVGR version.

In the meanwhile remember to rename the SVGs and maybe we should add an alert in the accurapp README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants