Skip to content

Commit de076b8

Browse files
committed
fixed preload.js loading and paths issue
1 parent ff03ffc commit de076b8

File tree

7 files changed

+83
-190
lines changed

7 files changed

+83
-190
lines changed

.erb/configs/webpack.config.main.prod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ const configuration: webpack.Configuration = {
7474
* https://github.com/webpack/webpack/issues/2010
7575
*/
7676
node: {
77-
__dirname: false,
78-
__filename: false,
77+
__dirname: true,
78+
__filename: true,
7979
},
8080
};
8181

.erb/configs/webpack.paths.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const srcNodeModulesPath = path.join(srcPath, 'node_modules');
1515

1616
const distPath = path.join(appPath, 'dist');
1717
const distMainPath = path.join(distPath, 'main');
18+
const distRendererPath = path.join(distPath, 'renderer');
1819

1920
const buildPath = path.join(releasePath, 'build');
2021

@@ -30,5 +31,6 @@ export default {
3031
srcNodeModulesPath,
3132
distPath,
3233
distMainPath,
34+
distRendererPath,
3335
buildPath,
3436
};

package-lock.json

Lines changed: 53 additions & 178 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@
5656
"electron-log": "^5.4.3",
5757
"electron-store": "^11.0.2",
5858
"electron-updater": "^6.6.2",
59+
"fs-extra": "^11.3.2",
5960
"msgpack-lite": "^0.1.26",
6061
"util": "^0.12.5"
6162
},
6263
"devDependencies": {
64+
"@cspotcode/source-map-support": "^0.8.1",
6365
"@types/detect-port": "^2.0.0",
6466
"@types/msgpack-lite": "^0.1.12",
65-
"@types/node": "24.10.1",
67+
"@types/node": "^24.10.1",
6668
"@types/webpack-bundle-analyzer": "^4.7.0",
6769
"axios-logger": "^2.8.1",
6870
"chalk": "5.6.2",
@@ -79,7 +81,7 @@
7981
"identity-obj-proxy": "^3.0.0",
8082
"nanospinner": "^1.2.2",
8183
"prettier": "^3.6.2",
82-
"rimraf": "^6.1.0",
84+
"rimraf": "^2.7.1",
8385
"ts-loader": "^9.5.4",
8486
"ts-node": "^10.9.2",
8587
"tsconfig-paths": "^4.2.0",

src/main/paths.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { app } from 'electron';
2-
import * as path from 'node:path';
2+
// import * as path from 'node:path';
33

4-
const __dirname = path.resolve(process.cwd());
4+
// const __dirname = path.resolve(process.cwd());
5+
6+
import path from 'path';
7+
8+
const __filename = process.argv[1] ?? '';
9+
const __dirname = path.resolve(__filename ? path.dirname(__filename) : process.cwd());
510

611
export const RESOURCES_PATH = app.isPackaged
712
? path.join(process.resourcesPath, 'assets')

0 commit comments

Comments
 (0)