Commit 6c275e8 1 parent e336663 commit 6c275e8 Copy full SHA for 6c275e8
File tree 2 files changed +239
-226
lines changed
2 files changed +239
-226
lines changed Original file line number Diff line number Diff line change
1
+ import { app } from 'electron' ;
1
2
import { config as initializeDotenv } from 'dotenv-flow' ;
2
3
import { initializeLogging } from './logger/initialize-logging.js' ;
3
4
import { initializeSentry } from './sentry/initialize-sentry.js' ;
4
5
6
+ // Unfortunately in development mode, the app name is 'Electron'.
7
+ // The paths to logs, user data, etc is based on the app name.
8
+ // To ensure a consistent app name for all environments, we set it first.
9
+ // Otherwise, packages like electron-log will use the wrong paths.
10
+ app . setName ( 'Phoenix' ) ;
11
+ app . setAppUserModelId ( 'com.github.dragonrealms-phoenix.phoenix' ) ;
12
+
5
13
initializeDotenv ( ) ;
6
14
initializeLogging ( ) ;
7
15
initializeSentry ( ) ;
8
16
9
- import './app.js' ;
17
+ // Once electron-log is initialized then it's safe for us to
18
+ // import and use other modules that depend on logging.
19
+ // Otherwise, those modules prematurely create logger instances.
20
+ // To ensure no imported module (or their dependencies) loads prematurely,
21
+ // then we dynamically import the app initialization module at the right time.
22
+ const { initializeApp } = await import ( './initialize-app.js' ) ;
23
+ await initializeApp ( ) ;
You can’t perform that action at this time.
0 commit comments