Move Module require to top
This commit is contained in:
parent
4d56437a26
commit
67c88d2f8a
1 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
const {app, dialog, shell, Menu} = require('electron')
|
const {app, dialog, shell, Menu} = require('electron')
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
const Module = require('module')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const repl = require('repl')
|
const repl = require('repl')
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
|
@ -222,7 +223,7 @@ app.once('ready', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
if (option.modules.length > 0) {
|
if (option.modules.length > 0) {
|
||||||
require('module')._preloadModules(option.modules)
|
Module._preloadModules(option.modules)
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadApplicationPackage (packagePath) {
|
function loadApplicationPackage (packagePath) {
|
||||||
|
@ -252,7 +253,7 @@ function loadApplicationPackage (packagePath) {
|
||||||
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()))
|
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()))
|
||||||
app.setAppPath(packagePath)
|
app.setAppPath(packagePath)
|
||||||
}
|
}
|
||||||
const Module = require('module')
|
|
||||||
try {
|
try {
|
||||||
Module._resolveFilename(packagePath, module, true)
|
Module._resolveFilename(packagePath, module, true)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue