react-lottie
react-lottie copied to clipboard
Cannot read property 'length' of undefined at SVGRenderer.configAnimation
I know many people got the same error but I have a weird situation. I got this error when I migrated to webpack 4 from webpack 2. It was working fine in webpack 2. I am using exact same version number and animation file just the web pack version is different.
I read in other similar [issues] (https://github.com/airbnb/lottie-web/issues/1120) and some suggested it's because of uglification but when I looked at the source, I found this in (bodymovin.js:5720)
this.elements = Array.apply(null,{length:animData.layers.length})
it doesn't seems to be uglified. I think the problem is in the lottie-web not in this wrapper. Any idea?
#24 also didn't help. I am not using react-script.
Hey there's some new updates on that issue, we found it helpful https://github.com/chenqingspring/react-lottie/issues/24
I'm seeing this error in CRA2
As @eliasrodeloso suggested in #24, I fixed this by changing:
import * as animationData from '../../assets/animations/myAnimation.json';
To:
import animationData from '../../assets/animations/myAnimation.json';