From 449d2752f2291625e6140f989accca8d51af91d7 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 3 Jun 2019 01:03:33 -0700 Subject: [PATCH] refactor: lazy load V8 module in browser/init (#18575) --- lib/browser/init.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/browser/init.ts b/lib/browser/init.ts index 43634a794a34..762fa6c70e7c 100644 --- a/lib/browser/init.ts +++ b/lib/browser/init.ts @@ -2,7 +2,6 @@ import { Buffer } from 'buffer' import * as fs from 'fs' import * as path from 'path' import * as util from 'util' -import * as v8 from 'v8' const Module = require('module') @@ -141,9 +140,10 @@ if (packageJson.desktopName != null) { app.setDesktopName(`${app.name}.desktop`) } -// Set v8 flags +// Set v8 flags, delibrately lazy load so that apps that do not use this +// feature do not pay the price if (packageJson.v8Flags != null) { - v8.setFlagsFromString(packageJson.v8Flags) + require('v8').setFlagsFromString(packageJson.v8Flags) } app._setDefaultAppPaths(packagePath)