capacitor-community / electron

Deploy your Capacitor apps to Linux, Mac, and Windows desktops, with the Electron platform! 🖥️
https://capacitor-community.github.io/electron/
MIT License
318 stars 58 forks source link

Electron window not opening after installing @capacitor-community/sqlite dependency #212

Closed beligatclement closed 1 year ago

beligatclement commented 1 year ago

Electron window not opening on npx cap open @capacitor-community/electron after installing dependency @capacitor-community/sqlite. Linked issue on @capacitor-community/sqlite repo : #327.

Steps to reproduce the behavior: Have a working @capacitor-community/electron project.

npm i @capacitor-community/sqlite
ng build
npx cap sync
npx cap add @capacitor-community/electron
cd electron
npm install --save sqlite3
npm install --save jszip
npm install --save-dev @types/sqlite3
cd ..
npx cap open @capacitor-community/electron

image

Is there a way to display log on open ?

Expected behavior Electron window open with @capacitor-community/sqlite dependency.

Desktop :

Dependencies :

"@capacitor-community/electron": "^4.1.2",
"@capacitor-community/sqlite": "^4.1.1",
"@capacitor/android": "^4.3.0",
"@capacitor/angular": "^2.0.3",
"@capacitor/core": "^4.3.0",
"@capacitor/ios": "^4.3.0",

Dev dependencies :

"@capacitor/cli": "^4.3.0",
beligatclement commented 1 year ago

I resolve my issue by adding into capacitor.config.ts a plugins property for CapacitorSQLite.

plugins: {
    CapacitorSQLite: {
      ...CapacitorSQLite,
      electronLinuxLocation: "/tmp/CapacitorDatabases"
    }
  }

Full file :

import { CapacitorConfig } from '@capacitor/cli';
import { CapacitorElectronConfig, ElectronConfig } from '@capacitor-community/electron';
import { CapacitorSQLite } from "@capacitor-community/sqlite";

const config: CapacitorConfig = {
  appId: 'com.my.app',
  appName: 'my-app'',
  webDir: 'dist/my-app',
  bundledWebRuntime: false
};

const configElectron: ElectronConfig = {
}

const configGlobal: CapacitorElectronConfig = {
  ...config,
  electron: configElectron,
  plugins: {
    CapacitorSQLite: {
      ...CapacitorSQLite,
      electronLinuxLocation: "/tmp/CapacitorDatabases"
    }
  }
};

export default configGlobal;