Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Electron build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
grctest committed Aug 1, 2024
1 parent eda9b69 commit 049c9ab
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 703 deletions.
579 changes: 1 addition & 578 deletions app/background.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/background.js.map

Large diffs are not rendered by default.

120 changes: 1 addition & 119 deletions app/preload.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/preload.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function(env) {
filename: "[name].js",
path: path.resolve(__dirname, "../app"),
},
mode: env === "production" ? "production" : "development",
mode: env && env.length ? env : "production",
node: {
__dirname: false,
__filename: false
Expand Down
2 changes: 1 addition & 1 deletion build/webpack.preload.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function(env) {
path: path.resolve(__dirname, "../app"),
},
target: 'electron-preload',
mode: env === "production" ? "production" : "development",
mode: env && env.length ? env : "production",

node: {
__dirname: false,
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@
"node_modules/**/*",
"package.json"
],
"extraResources": [
{
"from": "./astroDist",
"to": "astroDist"
}
],
"directories": {
"buildResources": "resources"
"buildResources": "resources",
"output": "dist"
},
"nsis": {
"oneClick": false,
Expand Down
10 changes: 9 additions & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ const createWindow = async () => {
});

const expressApp = express();
expressApp.use(express.static('astroDist'));

let astroDistPath;
if (process.env.NODE_ENV === 'development') {
astroDistPath = 'astroDist';
} else {
astroDistPath = path.join(process.resourcesPath, 'astroDist');
}

expressApp.use(express.static(astroDistPath));
expressApp.listen(8080, () => {
console.log("Express server listening on port 8080");
});
Expand Down

0 comments on commit 049c9ab

Please sign in to comment.