joaogarin / angular-electron

Angular2 and Electron starter using webpack
150 stars 53 forks source link

Move main.js to root folder #73

Closed 18steps closed 7 years ago

18steps commented 7 years ago

When people inevitably want to package the electron app, they will have problems if main.js is not in the same folder as node_modules.

Therefore, move main.js to root folder, and update mainWindow.loadURL() to use the new relative location of index.html.

See this issue with electron package manager not bundling node_modules. It was leaving the node_modules in the output folder empty, when it should have been bundling the ones used by the application.

It's kind of a quiet problem until you create a Windows installer, because the exe in the output folder will run with the node_modules from the ancestor node_modules folder, but there will be no node_modules bundled.

joaogarin commented 7 years ago

Thanks mate!;)

briosheje commented 7 years ago

Not sure whether I've already solved this once, but I didn't encounter any issue by using the package manager for windows (both x32 and x64).

What I would also suggest (packaging-related) is finding a way to avoid boundling the typescript source code: there is a clean way to create the windows standalone without the "original source code", which is removing all the typescript files and folders from the generated package. I'm currently doing it manually, but I'm pretty sure there is a cleverer way to avoid it using electron-packager.