fix/ jslib in main process error

This commit is contained in:
Maxime GRIS
2018-08-22 10:25:26 +02:00
parent d8818c18c0
commit ef33f5ed16
3 changed files with 7 additions and 7 deletions

View File

@@ -73,6 +73,10 @@ You can desactivate "Developer Tools" by commenting `win.webContents.openDevTool
**Your application is optimised. Only /dist folder and node dependencies are included in the executable.** **Your application is optimised. Only /dist folder and node dependencies are included in the executable.**
## You want to use a specific lib (like rxjs) in electron main thread ?
You can to this! Just by importing your library in npm dependencies (not devDependencies) with `npm install --save`. It will be loaded by electron during build phase and added to the final package. Then use your librairy by importing it in `main.ts` file. Easy no ?
## Browser mode ## Browser mode
Maybe you want to execute the application in the browser with hot reload ? You can do it with `npm run ng:serve:web`. Maybe you want to execute the application in the browser with hot reload ? You can do it with `npm run ng:serve:web`.

View File

@@ -2,9 +2,6 @@ import { app, BrowserWindow, screen } from 'electron';
import * as path from 'path'; import * as path from 'path';
import * as url from 'url'; import * as url from 'url';
import { of } from 'rxjs';
import { timeout } from 'rxjs/operators';
let win, serve; let win, serve;
const args = process.argv.slice(1); const args = process.argv.slice(1);
serve = args.some(val => val === '--serve'); serve = args.some(val => val === '--serve');
@@ -45,8 +42,6 @@ function createWindow() {
win = null; win = null;
}); });
of(2000).pipe(timeout(1000))
.subscribe(val => console.log(`ES5 works fine : @${val}`));
} }
try { try {

View File

@@ -1,6 +1,6 @@
{ {
"name": "angular-electron", "name": "angular-electron",
"version": "4.2.0", "version": "4.2.1",
"description": "Angular 6 with Electron (Typescript + SASS + Hot Reload)", "description": "Angular 6 with Electron (Typescript + SASS + Hot Reload)",
"homepage": "https://github.com/maximegris/angular-electron", "homepage": "https://github.com/maximegris/angular-electron",
"author": { "author": {
@@ -37,7 +37,8 @@
"test": "npm run postinstall:web && ng test", "test": "npm run postinstall:web && ng test",
"e2e": "npm run postinstall:web && ng e2e" "e2e": "npm run postinstall:web && ng e2e"
}, },
"dependencies": {}, "dependencies": {
},
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "0.6.3", "@angular-devkit/build-angular": "0.6.3",
"@angular/cli": "6.1.2", "@angular/cli": "6.1.2",