From e6c1b3ba5d7633c9f47191113dab463163a7aa89 Mon Sep 17 00:00:00 2001 From: Maxime GRIS Date: Sat, 6 May 2017 01:05:13 +0200 Subject: [PATCH] Add comments of how conditional import works --- src/app/providers/electron.service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/providers/electron.service.ts b/src/app/providers/electron.service.ts index 528c1ec..0a02ff7 100644 --- a/src/app/providers/electron.service.ts +++ b/src/app/providers/electron.service.ts @@ -1,5 +1,7 @@ import { Injectable } from '@angular/core'; +// If you import a module but never use any of the imported values other than as TypeScript types, +// the resulting javascript file will look as if you never imported the module at all. import { ipcRenderer } from 'electron'; import * as childProcess from 'child_process'; @@ -10,6 +12,7 @@ export class ElectronService { childProcess: typeof childProcess; constructor() { + //Conditional imports if (this.isElectron()) { this.ipcRenderer = window.require('electron').ipcRenderer; this.childProcess = window.require('child_process');