Commit 81f6126
committed
fix(desktop-main): lazy-load electron-store to avoid requiring electron binary in tests
electron-store v11 imports electron at the top of its index.js, so any
require('electron-store') fails in plain-Node environments where the
electron binary hasn't been downloaded (e.g. integration test CI).
Switch the import to `import type` (type-only, no runtime effect) and
use createRequire inside createStore(), which is only called when
readIsElectron() returns true. Plain-Node paths continue to use the
in-memory Map fallback without ever loading electron-store.
Refs #1441 parent b132b30 commit 81f6126
1 file changed
Lines changed: 8 additions & 2 deletions
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | | - | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
147 | 150 | | |
148 | 151 | | |
149 | 152 | | |
150 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
151 | 157 | | |
152 | 158 | | |
153 | 159 | | |
| |||
0 commit comments