Closed thani-sh closed 7 years ago
As a temporary fix, restore the Promise replaced by babel-polyfill.
const _Promise = Promise;
const RxDB = require('rxdb');
Promise = _Promise;
You are right. Including the polyfill for everyone is not the final solution. I will figure out a better solution. Maybe someone has a hint on how other npm-libs handle the problem of including polyfills.
i have the same problem in angular2 with angular-cli
i add those code in polyfill.ts to make es6-promise polyfilled before zone.js init.
import 'core-js/es6/promise';
then, i can use es6 import style like that:
import * as RxDB from "rxdb";
import {RxDatabase, create as createRxDB, RxSchema, RxCollection} from 'rxdb';
import * as pouchDBAdapterIdb from 'pouchdb-adapter-idb';
import * as pouchDBAdapterWebsql from "pouchdb-adapter-websql";
RxDB.plugin(pouchDBAdapterIdb);
RxDB.plugin(pouchDBAdapterWebsql);
and than, i can use follow code in typescript:
cacheRxDatabase: RxDatabase;
cacheRxSchema: RxSchema;
cache: RxCollection;
and, mnmtanish's way case typescript cannot use type info, i hate that way.
then, please fix this issue,thx. @pubkey and, may be can not include pollyfill in rxdb, but include it with manual and say it in document?
@Lyoko-Jeremie Yes I know of this problem. As mentioned here, polyfills will not be included when v3.0.0 is out.
@pubkey nnnn, how long will v3 release ?
@Lyoko-Jeremie . It's released now. Can you check if the polyfill-problem is solved?
Closing this since no response. It should work in RxDB v3 now, reopen if you think otherwise.
The babel-polyfill causes build errors when used with Ionic2.