Skip to content

Commit cd663c3

Browse files
committed
chore(build): give preload package access to common types
1 parent 329d182 commit cd663c3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

electron/preload/tsconfig.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"compilerOptions": {
33
"composite": true,
4+
"rootDir": "..",
45
// Eletron does not support ESM in preload scripts in sandboxed renderers.
56
// So this package is compiled down to ES6 as commonjs.
67
// https://www.electronjs.org/docs/latest/tutorial/esm
78
"target": "ES6",
89
"module": "CommonJS",
910
"moduleResolution": "Node",
10-
"outDir": "../build/preload",
11+
"outDir": "../build", // creates 'preload' and 'common' subfolders
1112
"declaration": true,
1213
"declarationDir": "./",
1314
"sourceMap": true,
@@ -32,5 +33,5 @@
3233
"lib": ["DOM", "DOM.Iterable", "ESNext"]
3334
},
3435
"exclude": ["node_modules", "**/__tests__/**", "**/__mocks__/**"],
35-
"include": ["**/types.ts", "**/*.ts"]
36+
"include": ["**/types.ts", "**/*.ts", "../common/**/types.ts"]
3637
}

electron/preload/tsconfig.test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"module": "NodeNext",
66
"moduleResolution": "NodeNext",
77
"noEmit": true,
8-
"rootDir": "." // to find index.ts at root of package
8+
"rootDir": ".." // to find index.ts at root of package
99
},
1010
"exclude": ["node_modules"]
1111
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"start:dev": "yarn build:dev && APP_ENV=development electron ./electron/build/main/index.js",
5252
"build:common": "yarn clean && tsc -p electron/common",
5353
"build:main": "yarn clean && tsc -p electron/main",
54-
"build:preload": "yarn clean && tsc -p electron/preload && yarn prettier:fix electron/preload/**/*.d.ts",
54+
"build:preload": "yarn clean && yarn tsc --noEmit -p electron/preload && tsc -p electron/preload --isolatedModules null --declarationDir null --emitDeclarationOnly --declaration --outFile electron/preload/index.d.ts && yarn prettier:fix electron/preload/**/*.d.ts",
5555
"build:renderer": "yarn clean && next build electron/renderer && mv electron/renderer/out electron/build/renderer",
5656
"build": "yarn clean && concurrently \"yarn build:main\" \"yarn build:preload\" \"yarn build:renderer\"",
5757
"build:dev": "yarn clean && concurrently \"yarn build:main\" \"yarn build:preload\"",

0 commit comments

Comments
 (0)