indexeddbshim / IndexedDBShim

A polyfill for IndexedDB using WebSql
Other
968 stars 191 forks source link

Only one instance of babel-polyfill is allowed #303

Closed StabbarN closed 7 years ago

StabbarN commented 7 years ago

When migrating from latest 2.x to 3.0-rc6 we get the following error Error: only one instance of babel-polyfill is allowed when loading our app, which makes sense because it's already been included. We have other libraries that depend on babel-polyfill.

Is it a good idea to include babel-polyfill in indexeddbshim? What to do if it's already added?

I've successfully built indexeddbshim with babel-polyfill excluded from this shim by:

  1. Removed babel-polyfill from indexeddbshim's package.json
  2. Removed
    if (global._babelPolyfill) {
    // throw new Error("only one instance of babel-polyfill is allowed");
    }

    from dist/indexeddbshim.js

We use a makefile to transpile and build Javascript.

Thanks for an awesome shim! We use it on a lot of iOS devices but see a few random failures. We are eager to try out 3.x.

brettz9 commented 7 years ago

This is now addressed in RC 7. We had checks earlier to prevent this, but recently removed when removing babel-polyfill for Node. I think it makes more sense to separate it out (no less because it is recommended to be done this way). A little less convenient for users, but ah well--browsers will hopefully support the features quickly anyways.

Btw, if you are migrating old apps, be sure to check out the CHANGES file, particularly the breaking changes. The biggest issue is probably that old database content will no longer work and there is unfortunately no migration path that we provide.

Closing for now as should be fixed but feel free to comment further.