BREAKING CHANGE(core): switch to esm

This commit is contained in:
2022-05-28 12:33:10 +02:00
parent dac5342a19
commit 7fa246e0e4
13 changed files with 2463 additions and 19392 deletions

View File

@@ -1,4 +1,4 @@
import * as plugins from './webstore.plugins';
import * as plugins from './webstore.plugins.js';
export interface IWebStoreOptions {
dbName: string;
@@ -22,6 +22,13 @@ export class WebStore<T = any> {
return;
}
this.initCalled = true;
const smartenv = new plugins.smartenv.Smartenv();
if (!smartenv.isBrowser) {
const fetch = await smartenv.getSafeNodeModule('fake-indexeddb/auto.js');
globalThis.fetch = fetch.default;
}
this.db = await plugins.idb.openDB(this.options.dbName, 1, {
upgrade: (db) => {
db.createObjectStore(this.options.storeName);