You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: "CapacitorSQLite" plugin is not implemented on electron #667
the plugin failed register while electron start;
the output of exported in rt/electron-plugins.js
module.exports = {
CapacitorCommunitySqlite
}
is: { CapacitorCommunitySqlite: { default: { CapacitorSQLite: [class CapacitorSQLite] } } }
compare with version 5, the exported which work fine is:
CapacitorCommunitySqlite: {
CapacitorSQLite: [class CapacitorSQLite], <=============== Missing this in version 7
default: { CapacitorSQLite: [class CapacitorSQLite] }
}
i had tried manually populate it in electron-plugins.js (for version 7), then work fine too
module.exports = {
CapacitorCommunitySqlite:{
...CapacitorCommunitySqlite,
CapacitorSQLite:CapacitorCommunitySqlite.default.CapacitorSQLite
},
}
but this is not good solution, because every time ionic cap sync electron will overwrite back the rt/electron-plugins.js file.
Additional Context: ESM/CJS Resolution Issues in Hybrid Environments (@capacitor-community/electron)
Hi team,
I wanted to provide some additional context regarding module resolution failures when using @capacitor-community/sqlite (v7+) alongside @capacitor-community/electron (or legacy Electron runners).
Problem Breakdown
Starting with recent major updates, @capacitor-community/sqlite shifted its entry points to be ESM-first ("type": "module" in package.json), dropping fallback CommonJS exports for the web/renderer bindings.
While this aligns with modern bundlers (Vite, esbuild, Angular 19+), it breaks the plugin generator in @capacitor-community/electron. The Electron platform runner dynamically generates an electron-plugins.js file using synchronous CommonJS require() calls:
Since @capacitor-community/electron is largely unmaintained and lacks support for ESM-only plugins, the community-recommended path for modern Capacitor apps (Capacitor 6/7/8 with Angular 19+, Vite, or esbuild) is to migrate to the newly built and actively maintained alternative by Capawesome:
It has been rewritten from scratch with full native support for modern ESM packages, Node 22+, and modern build pipelines, eliminating these resolution issues altogether.
Workaround by Sqlite dependency's developers side
Developers currently bypass this either by patching package.json to expose a dual-package export (main / module / exports with CJS wrappers) or by manually patching the runner generator.
Having an explicit CommonJS bundle or dual ESM/CJS export in package.json for the plugin's web/electron entry points would prevent runtime crashes for projects using CommonJS-based platform runners.
I hope that the added information can help to understand the problem from developers and mantainers, to fix the problem by other developers facing the same issues.
Activity
AlejandroMHOB commentedon Sep 16, 2026
Additional Context: ESM/CJS Resolution Issues in Hybrid Environments (
@capacitor-community/electron)Hi team,
I wanted to provide some additional context regarding module resolution failures when using
@capacitor-community/sqlite(v7+) alongside@capacitor-community/electron(or legacy Electron runners).Problem Breakdown
Starting with recent major updates,
@capacitor-community/sqliteshifted its entry points to be ESM-first ("type": "module"inpackage.json), dropping fallback CommonJS exports for the web/renderer bindings.While this aligns with modern bundlers (Vite, esbuild, Angular 19+), it breaks the plugin generator in
@capacitor-community/electron. The Electron platform runner dynamically generates anelectron-plugins.jsfile using synchronous CommonJSrequire()calls:const CapacitorCommunitySqlite = require('..\\..\\..\\node_modules\\@capacitor-community\\sqlite\\electron\\dist\\plugin.js');module.exports = { CapacitorCommunitySqlite, ... }Workaround vs. Long-term Fix
Long-term Fix
Since
@capacitor-community/electronis largely unmaintained and lacks support for ESM-only plugins, the community-recommended path for modern Capacitor apps (Capacitor 6/7/8 with Angular 19+, Vite, or esbuild) is to migrate to the newly built and actively maintained alternative by Capawesome:👉 Capawesome Capacitor Electron Platform (
@capawesome/capacitor-electron)It has been rewritten from scratch with full native support for modern ESM packages, Node 22+, and modern build pipelines, eliminating these resolution issues altogether.
Workaround by Sqlite dependency's developers side
Developers currently bypass this either by patching
package.jsonto expose a dual-package export (main/module/exportswith CJS wrappers) or by manually patching the runner generator.Having an explicit CommonJS bundle or dual ESM/CJS export in
package.jsonfor the plugin's web/electron entry points would prevent runtime crashes for projects using CommonJS-based platform runners.I hope that the added information can help to understand the problem from developers and mantainers, to fix the problem by other developers facing the same issues.
Greeting.