Jeep-sqlite加载程序未在web中运行

lp0sw83n  于 2023-08-06  发布在  SQLite
关注(0)|答案(1)|浏览(112)

我用Vite Vue Ionic capacitor 5(最新版本)和SQLite构建了一个应用程序。我尝试用@capacitor-community/sqlite实现包。在移动的模拟器上一切运行良好,但在浏览器jeep-sqlite.entry.js中未找到:
x1c 0d1x的数据
初始连接:

state() {
return {
  platform: Capacitor.getPlatform(),
  apiCon: null,
  db: null,
  dbdriver: new SQLiteConnection(CapacitorSQLite),
  network: {
    connected: false,
    connectionType: "none",
  },
};
}

applyPolyfills().then(() => {
        jeepSqlite(window);
      });
      console.log("1");

      // Create the 'jeep-sqlite' Stencil component

      const jeepEl = await document.createElement("jeep-sqlite");
      console.log("2");

      await document.body.appendChild(jeepEl);
      console.log("3");

      await customElements.whenDefined("jeep-sqlite");
      console.log("4");

      // Initialize the Web store

      await this.state.dbdriver.initWebStore();
      console.log("5");

字符串
步骤1至4已运行。如何解决此问题?

mbyulnm0

mbyulnm01#

我在Vite React离子电容器设置中遇到了同样的问题。您需要在vite.config.ts中将jeep-sqlite loader从optimize deps中排除:

export default defineConfig({
  optimizeDeps: {
    exclude: ['jeep-sqlite/loader']
  }
});

字符串

相关问题