I am working with ES6 modules and when I install @casl/ability version 2.4.2 and import it in my code
import { Ability } from '@casl/ability';
It throws an error about the dependency sift.js, error is:
Uncaught (in promise) SyntaxError: The requested module '../../../../sift/sift.js' does not provide an export named 'default'
Seems that that dependency is not compiled for ES6 modules
Any advice?
Thanks
Thanks for the issue! This is actually a hard question. I see 2 options for quick fix:
sift.js to provide ES6 versionI'll investigate
One more solution would be migration to mingo which has ES6 build. But I need to talk to its author to reduce lib size.
siftjs added es6 version! I鈥檒l fix this on this Sat
Great to hear that, thanks @stalniy !
Published @casl/[email protected] with the latest sift.js
As far as I understood ES6 module system is not completed in browsers. At least there are some issues related to loading external dependencies. You can read this article https://medium.com/@dmnsgn/es-modules-in-the-browser-almost-now-3638ffafdc68 for details. Probably the best option for now is to use service worker mapping (or simple stupid match and replace approach).
Update:
This is all I can do for now. Let me know if you have questions or proposals!