bealearts / css-animation-sync

Synchronise and control CSS Animations
MIT License
48 stars 3 forks source link

Uncaught ReferenceError: module is not defined js:201 js:12 js:15 #25

Closed freddieventura closed 2 years ago

freddieventura commented 3 years ago

Thanks for the library , I wanted to start using it , so I have used a CDN from unpkg.com For that my code looks like

<script type="module" src="https://unpkg.com/css-animation-sync">

import sync from './css-animation-sync';
sync('spinner');
const animation = new sync(buttonBlink);

</script>

After parsing that the Browser console outputs me the following

sync.js:201 Uncaught ReferenceError: module is not defined
    at sync.js:201
    at sync.js:12
    at sync.js:15
(anonymous) @ sync.js:201
(anonymous) @ sync.js:12
(anonymous) @ sync.js:15

Which are linked to the following lines respectively

    factory(mod.exports);
})(void 0, function (exports) {
  module.exports = exports.default;

Also , it seems like your library is either not working or I'm probably not understanding well the functionality that it provides

DavidBeale commented 2 years ago

You are getting the non-ESM version. To get the ESM version use https://unpkg.com/css-animation-sync?module