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

params.path.substr is not a function #235

Closed
Ethan-Arrowood opened this issue Jan 31, 2017 · 6 comments
Closed

params.path.substr is not a function #235

Ethan-Arrowood opened this issue Jan 31, 2017 · 6 comments

Comments

@Ethan-Arrowood
Copy link

I am building a React application with webpack and I am loading bodymovin.js through my index.html file and loading it using webpack 2 externals property (This all works fine however...)

When I give my code a run in the browser I get an error from the bodymovin.js file:
params.path.substr is not a function line 7465

Please advise
Thank you!

@bodymovin
Copy link
Collaborator

are you passing the animation as an object or as a path to a json file?
is it possible that webpack is importing and inlining it?

@Ethan-Arrowood
Copy link
Author

I am using inside my React component render() {} method:
bodymovin.loadAnimation({
container: document.getElementById('fire'),
animType: 'svg',
loop: true,
prerender: true,
autoplay: true,
path: data
})

and fyi data is a variable declared like so:
import data from './components/data.json';

@Ethan-Arrowood
Copy link
Author

OMG It all just clicked. Your js needs that path prop to be a string not an imported object. Okay let me see what I can do now.

@bodymovin
Copy link
Collaborator

instead of using "path" use "animationData" and pass that object. It should work as well.
No need to revert to a path string.

@Ethan-Arrowood
Copy link
Author

Everything works! Thank you so much 💯

@bodymovin
Copy link
Collaborator

nice!

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