You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-8
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,6 @@ npm install
48
48
49
49
There is an issue with `yarn` and `node_modules` when the application is built by the packager. Please use `npm` as dependencies manager.
50
50
51
-
52
51
If you want to generate Angular components with Angular-cli , you **MUST** install `@angular/cli` in npm global context.
53
52
Please follow [Angular-cli documentation](https://github.com/angular/angular-cli) if you had installed a previous version of `angular-cli`.
54
53
@@ -62,17 +61,26 @@ npm install -g @angular/cli
62
61
63
62
Voila! You can use your Angular + Electron app in a local development environment with hot reload!
64
63
65
-
The application code is managed by `main.ts`. In this sample, the app runs with a simple Angular App (http://localhost:4200) and an Electron window.
66
-
The Angular component contains an example of Electron and NodeJS native lib import.
67
-
You can disable "Developer Tools" by commenting `win.webContents.openDevTools();` in `main.ts`.
64
+
The application code is managed by `app/main.ts`. In this sample, the app runs with a simple Angular App (http://localhost:4200), and an Electron window. \
65
+
The Angular component contains an example of Electron and NodeJS native lib import. \
66
+
You can disable "Developer Tools" by commenting `win.webContents.openDevTools();` in `app/main.ts`.
67
+
68
+
## Project structure
69
+
70
+
|Folder|Description|
71
+
| ---- | ---- |
72
+
| app | Electron main process folder (NodeJS) |
73
+
| src | Electron renderer process folder (Web / Angular) |
68
74
69
75
## Use Electron / NodeJS libraries
70
76
71
-
This sample project runs in both modes (web and electron). To make this work, **you have to import your dependencies the right way**. Please check `providers/electron.service.ts` to watch how conditional import of libraries has to be done when using electron / NodeJS / 3rd party libraries in renderer context (i.e. Angular).
77
+
3rd party libraries used in electron's main process (like an ORM) have to be added in `dependencies` of `app/package.json`.
78
+
This sample project runs in both modes (web and electron). To make this work, **you have to import your dependencies the right way**. \
72
79
73
80
## Use "web" 3rd party libraries (like angular, material, bootstrap, ...)
74
81
75
-
3rd party librairies used in electron's renderer process (like angular) have to be added in `devDependencies` of `package.json`. They are already added in your final package during webpack's compilation phase. Otherwise it will significantly increase the size of your final package... not so cool :(
82
+
3rd party libraries used in electron's renderer process (like angular) have to be added in `dependencies` of `package.json`. \
83
+
Please check `providers/electron.service.ts` to watch how conditional import of libraries has to be done when using NodeJS / 3rd party libraries in renderer context (i.e. Angular).
76
84
77
85
## Browser mode
78
86
@@ -88,11 +96,13 @@ Maybe you only want to execute the application in the browser with hot reload? J
88
96
|`npm run electron:local`| Builds your application and start electron
89
97
|`npm run electron:build`| Builds your application and creates an app consumable based on your operating system |
90
98
91
-
**Your application is optimised. Only /dist folder and node dependencies are included in the executable.**
99
+
**Your application is optimised. Only /dist folder and NodeJS dependencies are included in the final bundle.**
92
100
93
101
## You want to use a specific lib (like rxjs) in electron main thread ?
94
102
95
-
YES! You can do it! Just by importing your library in npm dependencies section (not **devDependencies**) with `npm install --save`. It will be loaded by electron during build phase and added to your final package. Then use your library by importing it in `main.ts` file. Quite simple, isn't it?
103
+
YES! You can do it! Just by importing your library in npm dependencies section of `app/package.json` with `npm install --save XXXXX`. \
104
+
It will be loaded by electron during build phase and added to your final bundle. \
105
+
Then use your library by importing it in `app/main.ts` file. Quite simple, isn't it?
0 commit comments