Closed gautamsi closed 5 years ago
I was able to achieve like this
const cwd = process.cwd();
const { resolve } = require("path");
module.exports = {
webpack: (defaultConfig, env) => Object.assign(defaultConfig, {
entry: {
background: "./main/electron.ts",
},
output: {
...defaultConfig.output,
filename: "electron.js",
path: resolve(cwd, "electron"),
}
}),
};
not sure if that has any consequence to production build, will figure out :)
Hi @gautamsi
Thank you for your questions!
It is not possible to rename app/background.js
because we run electron .
when development mode.
$ electron .
(run electron with the current directory)./package.json#main
package.json
main field must be one of theseindex.js
(recommended by electron)app/background.js
(the compatibility for electron-builder
's default source directory)We adopt the app/background.js
way because of simple directory structures.
(And because of the existence of apps based on source compiling like Next.js and typescript.)
If you use JavaScript only, the structure of just two files index.js
and index.html
is the simplest solution.
But if you have any another solutions, please send a PR at any time!
@gautamsi
If you have any troubles, feel free to issue me up again :)
is it possible to use
app/background.js
(in package.json) to something else? I saw build directory name to benextron
, seems like that has been renamed toapp
any config option?