misc/ clarify node lib import

This commit is contained in:
Maxime GRIS
2020-08-30 13:13:03 +02:00
parent 2964fc45a8
commit f41ce65e79

View File

@@ -63,6 +63,14 @@ The application code is managed by `main.ts`. In this sample, the app runs with
The Angular component contains an example of Electron and NodeJS native lib import.
You can disable "Developer Tools" by commenting `win.webContents.openDevTools();` in `main.ts`.
## Use Electron / NodeJS / 3rd party libraries
As see in previous chapter, this sample project runs on both mode (web and electron). To make this happens, **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 librairies in renderer context (ie. Angular).
## Browser mode
Maybe you only want to execute the application in the browser with hot reload ? Just run `npm run ng:serve:web`.
## Included Commands
|Command|Description|
@@ -79,11 +87,6 @@ You can disable "Developer Tools" by commenting `win.webContents.openDevTools();
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 ?
## Browser mode
Maybe you want to execute the application in the browser with hot reload ? Just run `npm run ng:serve:web`.
**Note that you can't use Electron or NodeJS native libraries in this case.** Please check `providers/electron.service.ts` to watch how conditional import of electron/Native libraries is done.
## E2E Testing
E2E Test scripts can be found in `e2e` folder.