refactor: lazy load V8 module in browser/init (#18575)

This commit is contained in:
Samuel Attard
2019-06-03 01:03:33 -07:00
committed by GitHub
parent bc527f6b51
commit 449d2752f2

View File

@@ -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)