Anime: ERROR TypeError: animejs__WEBPACK_IMPORTED_MODULE_1__ is not a function

Created on 6 Feb 2019  路  8Comments  路  Source: juliangarnier/anime

Describe the bug
Using the version 3 of this library with TypeScript and WebPack, the console throws the following error:
ERROR TypeError: animejs__WEBPACK_IMPORTED_MODULE_1__ is not a function

I'm not exactly sure if the problem comes from the new version of this library, or if the type definition are outdated (@types/animejs).

To Reproduce
Steps to reproduce the behavior:

  1. install angular (as it has TS enabled it's the fastest way to get to it) and run ng new myProject
  2. Install animejs and the type definition (@types/animejs) using npm
  3. Use the anime function in any component (import * as anime from 'animejs';)
  4. See error

Expected behavior
See animation without error.

Desktop (please complete the following information):

  • OS: OSX
  • Browser: Chrome
  • Version: Latest

Most helpful comment

I had this issue too, to fix its I had to use the following import: import anime from 'animejs/lib/anime.es';

All 8 comments

I am seeing the same exact error....haven't been able to solve this.

I was able to get rid of the error with Angular 7 by rolling anime.js back to version 2.2.0.

@christopher-harris indeed, that's why I said

I'm not exactly sure if the problem comes from the new version of this library, or if the type definition are outdated (@types/animejs).

I had this issue too, to fix its I had to use the following import: import anime from 'animejs/lib/anime.es';

527

npm i animejs
npm i @types/animejs
import anime from 'animejs/lib/anime.es';

use directly anime, work fine on angular 7 @ashhitch +1

Worked for me too ! +1 @ashhitch 馃槃

Thanks,
import anime from 'animejs/lib/anime.es';
works for me too.

Fixed! Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrgnou picture mrgnou  路  6Comments

DavudSafarli picture DavudSafarli  路  5Comments

LiveLikeCounter picture LiveLikeCounter  路  3Comments

gaou-piou picture gaou-piou  路  3Comments

trusktr picture trusktr  路  6Comments