jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.31k stars 356 forks source link

Output not properly transpiled when imported in JS #160

Closed lkreher closed 4 years ago

lkreher commented 4 years ago

Using webpack and the latest version of this library resulted in an output that still contained literal usages of "async" and "await":

            const c = async function(e, ...t) {
                const a = this.transaction(e, s ? "readwrite" : "readonly");
                let o = a.store;
                r && (o = o.index(t.shift()));
                const i = o[n](...t);
                return s && await a.done,
                i
            };

This caused our app to break on older systems and could only be solved by using babel on the library. Since there are no minimum system requirements listed for this library I'm assuming this is unintentional and should be fixed.

jakearchibald commented 4 years ago

I'm expecting folks to apply transpiling to this library if they need to. And, if you're using webpack, you're already doing that, you're converting it from ESM to Webpack's loader.

lkreher commented 4 years ago

Fair enough, it's just uncommon to have libraries not transpile to ES5 and having to explicitly run them through babel, so my first guess was this was happening by mistake. Thanks for the fast response, and since it's not actually a problem with the library, it's okay to close the issue.

jakearchibald commented 4 years ago

ES6 is smaller. I want folks to benefit from that if they can.

It kinda annoys me that other libraries transpile to lowest common denominator. I end up with a bloated bundle even though I'm targeting browsers that support async/await 😢