From f41ce65e795545754a98dcfc3b4a80fa8582a5dd Mon Sep 17 00:00:00 2001 From: Maxime GRIS Date: Sun, 30 Aug 2020 13:13:03 +0200 Subject: [PATCH] misc/ clarify node lib import --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f1de00301..6b3762fc1 100644 --- a/README.md +++ b/README.md @@ -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.