Skip to content

Commit

Permalink
Replace uglify-es to terser
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtkowiak committed Jul 20, 2018
1 parent ec45178 commit b583072
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
19 changes: 11 additions & 8 deletions lib/electronApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import path from 'path';
import shell from 'shelljs';
import spawn from 'cross-spawn';
import semver from 'semver';
import uglify from 'uglify-es';
import uglify from 'terser';

import { getGypEnv } from 'electron-builder-lib/out/util/yarn';

Expand Down Expand Up @@ -347,13 +347,6 @@ export default class ElectronApp {
process.exit(1);
}

try {
await this.linkNpmPackages();
} catch (e) {
this.log.error(`linking packages failed: ${e}`);
process.exit(1);
}

try {
await this.rebuildDeps(true);
} catch (e) {
Expand All @@ -370,6 +363,13 @@ export default class ElectronApp {
}
}

try {
await this.linkNpmPackages();
} catch (e) {
this.log.error(`linking packages failed: ${e}`);
process.exit(1);
}

try {
await this.installLocalNodeModules();
} catch (e) {
Expand Down Expand Up @@ -594,6 +594,9 @@ export default class ElectronApp {
* Runs npm link for every package specified in settings.json->linkPackages.
*/
async linkNpmPackages() {
if (this.$.env.isProductionBuild()) {
return;
}
const settings = this.$.desktop.getSettings();
const promises = [];
if ('linkPackages' in this.$.desktop.getSettings()) {
Expand Down
10 changes: 5 additions & 5 deletions plugins/bundler/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MeteorDesktopBundler {
'del',
'@babel/core',
'@babel/preset-env',
'uglify-es',
'terser',
'md5',
'cacache'
];
Expand Down Expand Up @@ -495,7 +495,7 @@ class MeteorDesktopBundler {
let shelljs;
let babelCore;
let babelPresetEnv;
let uglifyEs;
let terser;
let del;
let cacache;
let md5;
Expand Down Expand Up @@ -693,7 +693,7 @@ class MeteorDesktopBundler {
del,
babelCore,
babelPresetEnv,
uglifyEs,
terser,
md5
} = deps);
} catch (e) {
Expand Down Expand Up @@ -804,7 +804,7 @@ class MeteorDesktopBundler {
let code = cacheEntry.data;
let error;
if (settings.env === 'prod' && uglifyingEnabled) {
({ code, error } = uglifyEs.minify(code.toString('utf8'), options));
({ code, error } = terser.minify(code.toString('utf8'), options));
}
if (error) {
reject(error);
Expand Down Expand Up @@ -836,7 +836,7 @@ class MeteorDesktopBundler {
let error;
if (settings.env === 'prod' && uglifyingEnabled) {
({ code: uglifiedCode, error } =
uglifyEs.minify(code, options));
terser.minify(code, options));
}

if (error) {
Expand Down

0 comments on commit b583072

Please sign in to comment.