[Updater > v2] Fix minified build by not relying on relative path for native module
This commit is contained in:
parent
b6952b89f2
commit
b8c64e2fe8
1 changed files with 8 additions and 17 deletions
|
@ -5,21 +5,17 @@
|
||||||
/* eslint camelcase: 0 */
|
/* eslint camelcase: 0 */
|
||||||
const childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
|
|
||||||
const {
|
const { app } = require('electron');
|
||||||
app
|
|
||||||
} = require('electron');
|
|
||||||
|
|
||||||
const {
|
const { EventEmitter } = require('events');
|
||||||
EventEmitter
|
|
||||||
} = require('events');
|
|
||||||
|
|
||||||
const NodeModule = require('module');
|
const NodeModule = require('module');
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const {
|
const { hrtime } = require('process');
|
||||||
hrtime
|
|
||||||
} = require('process');
|
const paths = require('../paths');
|
||||||
|
|
||||||
let instance;
|
let instance;
|
||||||
const TASK_STATE_COMPLETE = 'Complete';
|
const TASK_STATE_COMPLETE = 'Complete';
|
||||||
|
@ -39,12 +35,11 @@ class Updater extends EventEmitter {
|
||||||
if (nativeUpdaterModule == null) {
|
if (nativeUpdaterModule == null) {
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line import/no-unresolved
|
// eslint-disable-next-line import/no-unresolved
|
||||||
nativeUpdaterModule = require('../../../updater');
|
nativeUpdaterModule = require(paths.getExeDir() + '/updater');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code === 'MODULE_NOT_FOUND') {
|
log('Updater', 'Failed to require nativeUpdater', e);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (e.code === 'MODULE_NOT_FOUND') return;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,10 +417,6 @@ function getUpdaterPlatformName(platform) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryInitUpdater(buildInfo, repositoryUrl) {
|
function tryInitUpdater(buildInfo, repositoryUrl) {
|
||||||
// We can't require this in module scope because it's not part of the
|
|
||||||
// bootstrapper, which carries a copy of the Updater class.
|
|
||||||
const paths = require('../paths');
|
|
||||||
|
|
||||||
const rootPath = paths.getInstallPath(); // If we're not running from an actual install directory, don't bother trying
|
const rootPath = paths.getInstallPath(); // If we're not running from an actual install directory, don't bother trying
|
||||||
// to initialize the updater.
|
// to initialize the updater.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue