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

Error loading large SVG icons #35

Closed
tkvw opened this issue Jan 12, 2018 · 3 comments
Closed

Error loading large SVG icons #35

tkvw opened this issue Jan 12, 2018 · 3 comments

Comments

@tkvw
Copy link

tkvw commented Jan 12, 2018

When I import flag-icon-css library, the transformation fails with the following error:

Failed to compile.

./node_modules/flag-icon-css/flags/1x1/do.svg
Module build failed: RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    at Array.forEach (<anonymous>)
    at Array.forEach (<anonymous>)

This icon is 456 kb, so maybe it has something to do with this?

@gregberge
Copy link
Owner

It is very interesting. It should work but actually h2x is not very optimized. The problem is probably in the traverser. If someone is familiar with this and want to help he is welcome!

I will try to debug it on my side.

@gregberge
Copy link
Owner

Upgrading JSDOM smooth-code/h2x#8 would be a good start.

@gregberge
Copy link
Owner

Your SVG is so huge, but I found a way to do it, just increase the call stack size:

node --stack-size=10000 ./node_modules/.bin/svgr do.svg

I will not work on it because transforming huge SVG like that is not a common use case and there is actually a workaround.

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

No branches or pull requests

2 participants