Skip to content

Error with ES import #674

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

Open
DB-CL opened this issue Apr 10, 2020 · 1 comment
Open

Error with ES import #674

DB-CL opened this issue Apr 10, 2020 · 1 comment

Comments

@DB-CL
Copy link

DB-CL commented Apr 10, 2020

Describe the bug
I cannot get this library to work with typescript, it will always pop this error :

index.ts:1:19 - error TS2307: Cannot find module 'animejs/lib/anime.es.js'.

1 import anime from 'animejs/lib/anime.es.js';
                    ~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error.

To Reproduce
Steps to reproduce the behavior:

  1. mkdir testanimejs && cd testanime js && npm init
  2. npm install animejs
  3. npm install @types/animejs

Create a file with import anime from 'animejs/lib/anime.es.js'; and a simple anime example inside

  1. npx tsc index.ts --target es6

And this error will pop.

Maybe I'm missing something but as far as I understand this example should work.

@hblee12294
Copy link

Just use import anime from 'animejs'.

Take a look at the package.json:
{ ..., "module": "lib/anime.es.js", ...},
Webpack will import anime.es.js directly.

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