Skip to content

electron-store 8 to 12 #361

Done
Done

Description

@jtklein-agents

Question

What changes from electron-store 8 to 12 for src/main/appStore.ts and src/test/electron.ts: ESM-only bundling into the electron-vite main build (CommonJS output), API and option changes, the config file's location and format (does a 2.0.19 user's settings file load unchanged), and the minimum Electron/Node it needs?

Activity

  1. added
    wayfinder:research
    on Nov 24, 2026
  2. jtklein-agents commented on Nov 24, 2026

    @jtklein-agents
    OwnerAuthor

    Answer: upgrading to electron-store 12 needs only the version bump. It needs no settings migration and does not force ESM output for main.

    • Settings carry over unchanged. 8.2.0 and 12.0.0 both write userData/config.json (name config, cwd = app.getPath('userData')). conf 10 and conf 16 both write tab-indented JSON. Verified on Electron 45.2.3: a config.json written by 8.2.0 (darkMode: true) is read by 12.0.0 from the same path, and a write from 12 adds no __internal__ key. 8.2.0 also reads the file back after 12 writes it, so a downgrade works too.
    • The main build stays CommonJS. electron-vite 6 picks es output only when package.json has "type": "module". Electron 45 ships Node 24.22, which can require() an ES module, and the result is marked __esModule: true, so Vite's default-import interop works. I built and ran both variants: the default (externalized require("electron-store"), 1.6 kB) and externalizeDeps: { exclude: ['electron-store','conf'] } (inlined, about 453 kB). Both ran correctly.
    • No API changes affect our usage. We call new Store<{darkMode?}>(), .get and .set. The breaking changes in 9 to 12 cover pure ESM, JSON Schema 2020-12 (schema), and the conf 16 changes (migrations, clearInvalidConfig, encryptionKey, rootSchema, and .get() with a non-string key). None of them touch our calls.
    • Minimum versions: Electron 35 or later (we use 45) and Node 22 or later (engines; local 22.18, CI 24).
    • Test files: src/test/electron.ts needs no change. Its sendSync comment is stale, since electron-store no longer loads in the renderer. 12 throws outside Electron unless it gets an absolute cwd, but no test imports appStore. The src/preload.test.ts assertion stays valid.

    Open: a packaged (app.asar) run of the externalized require(esm) was not tested. Bundling electron-store into main, as the preload already does, avoids that question.

    Sources: electron-store releases (v9.0.0, v10.0.0, v11.0.0, v12.0.0), conf releases (v11 to v16), electron-store index.js at v8.2.0 and v12.0.0, conf source/index.ts at v10.2.0 and v16.0.0, and the electron-vite 6.0.0 dist source.

    Full notes: https://github.com/jtklein-agents/raxmlGUI/blob/research/electron-store-12/docs/research/electron-store-12.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

wayfinder:research

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions