Lottie-web: Uncaught SyntaxError: The requested module '../../node_modules/lottie-web/build/player/lottie.js' does not provide an export named 'default'

Created on 10 Mar 2020  路  2Comments  路  Source: airbnb/lottie-web

Browser and Browser Version: Chrome, Version 80.0.3987.122 (Official Build) (64-bit)

What did you do? Please explain the steps you took before you encountered the problem.
I followed this tutorial https://josephkhan.me/lottie-web/:
npm install lottie-web and thenimport lottie from 'lottie-web';

Then in the constructor() of the web component, I did the following:

this.anim= lottie.loadAnimation({
      container: this.shadowRoot.getElementById('anim'), 
      renderer: 'svg',
      loop: true,
      autoplay: true,
      animationData: './anim.json'
});

Later I start playing it: this.anim.play()

What did you expect to happen?
It works.

What actually happened? Please include as much _relevant_ detail as possible.
When the parent component appears, it does not render/show up. Instead there is this red error line in the console: Uncaught SyntaxError: The requested module '../../node_modules/lottie-web/build/player/lottie.js' does not provide an export named 'default'

Most helpful comment

I鈥檝e encountered the same error, it is because this does not provide a fully ES6 module.

It does when built via Webpack using the package.json main path and converting the file found into an ESM, but now that we have changed to Rollup.js we found out that we are unable to use it as a module.

Can you provide also an ES6 module?

Thank you

All 2 comments

hi, can you share a link with the project so I can check it out?
Besides this issue, any reason why you are not loading the library via the cdn?
You might get better performance keeping it out of your build.

I鈥檝e encountered the same error, it is because this does not provide a fully ES6 module.

It does when built via Webpack using the package.json main path and converting the file found into an ESM, but now that we have changed to Rollup.js we found out that we are unable to use it as a module.

Can you provide also an ES6 module?

Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hardy613 picture hardy613  路  4Comments

leantide picture leantide  路  3Comments

RenanSgorlom picture RenanSgorlom  路  3Comments

jumostudio picture jumostudio  路  3Comments

ochanje210 picture ochanje210  路  3Comments