aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main
diff options
context:
space:
mode:
Diffstat (limited to 'packages/main')
-rw-r--r--packages/main/esbuild.config.js10
-rw-r--r--packages/main/package.json2
-rw-r--r--packages/main/src/devTools.ts6
3 files changed, 7 insertions, 11 deletions
diff --git a/packages/main/esbuild.config.js b/packages/main/esbuild.config.js
index 7653078..a39534d 100644
--- a/packages/main/esbuild.config.js
+++ b/packages/main/esbuild.config.js
@@ -1,7 +1,5 @@
1// @ts-check 1import { node, fileURLToDirname } from '../../config/build-common.js';
2 2import { getConfig } from '../../config/esbuild-config.js';
3const { node } = require('../../config/build-common');
4const { getConfig } = require('../../config/esbuild-config');
5 3
6const externalPackages = ['electron']; 4const externalPackages = ['electron'];
7 5
@@ -9,8 +7,8 @@ if (process.env.MODE !== 'development') {
9 externalPackages.push('electron-devtools-installer'); 7 externalPackages.push('electron-devtools-installer');
10} 8}
11 9
12module.exports = getConfig({ 10export default getConfig({
13 absWorkingDir: __dirname, 11 absWorkingDir: fileURLToDirname(import.meta.url),
14 entryPoints: [ 12 entryPoints: [
15 'src/index.ts', 13 'src/index.ts',
16 ], 14 ],
diff --git a/packages/main/package.json b/packages/main/package.json
index c118d2b..99451bd 100644
--- a/packages/main/package.json
+++ b/packages/main/package.json
@@ -2,7 +2,7 @@
2 "name": "@sophie/main", 2 "name": "@sophie/main",
3 "version": "0.1.0", 3 "version": "0.1.0",
4 "private": true, 4 "private": true,
5 "main": "dist/index.cjs", 5 "type": "module",
6 "types": "dist-types/index.d.ts", 6 "types": "dist-types/index.d.ts",
7 "scripts": { 7 "scripts": {
8 "typecheck": "tsc" 8 "typecheck": "tsc"
diff --git a/packages/main/src/devTools.ts b/packages/main/src/devTools.ts
index 6c25b3e..7c7c86a 100644
--- a/packages/main/src/devTools.ts
+++ b/packages/main/src/devTools.ts
@@ -27,14 +27,12 @@ import type { BrowserWindow } from 'electron';
27 * because the mobx-state-tree devtools are currently unmaintained. 27 * because the mobx-state-tree devtools are currently unmaintained.
28 */ 28 */
29export async function installDevToolsExtensions(): Promise<void> { 29export async function installDevToolsExtensions(): Promise<void> {
30 const installerPackage = await import('electron-devtools-installer'); 30 // Hack to lazily require a CJS module from an ES module transpiled into a CJS module.
31 const { 31 const {
32 default: installExtension, 32 default: installExtension,
33 REACT_DEVELOPER_TOOLS, 33 REACT_DEVELOPER_TOOLS,
34 REDUX_DEVTOOLS, 34 REDUX_DEVTOOLS,
35 } = installerPackage.default instanceof Function 35 } = require('electron-devtools-installer');
36 ? installerPackage
37 : installerPackage.default as unknown as typeof import('electron-devtools-installer');
38 await installExtension( 36 await installExtension(
39 [ 37 [
40 REACT_DEVELOPER_TOOLS, 38 REACT_DEVELOPER_TOOLS,