BREAKING CHANGE(core): switch to esm
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user