Skip to content

Commit 8129ccc

Browse files
committed
Minify the js code when building for Firefox (bug 1965003)
It helps to improve the loading time in the worker by around 25% on Windows, Mac and Android.
1 parent d4d0081 commit 8129ccc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

gulpfile.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ function checkChromePreferencesFile(chromePrefsPath, webPrefs) {
491491

492492
function createMainBundle(defines) {
493493
const mainFileConfig = createWebpackConfig(defines, {
494-
filename: defines.MINIFIED ? "pdf.min.mjs" : "pdf.mjs",
494+
filename:
495+
defines.MINIFIED && !defines.MOZCENTRAL ? "pdf.min.mjs" : "pdf.mjs",
495496
library: {
496497
type: "module",
497498
},
@@ -571,7 +572,10 @@ function createSandboxBundle(defines, extraOptions = undefined) {
571572

572573
function createWorkerBundle(defines) {
573574
const workerFileConfig = createWebpackConfig(defines, {
574-
filename: defines.MINIFIED ? "pdf.worker.min.mjs" : "pdf.worker.mjs",
575+
filename:
576+
defines.MINIFIED && !defines.MOZCENTRAL
577+
? "pdf.worker.min.mjs"
578+
: "pdf.worker.mjs",
575579
library: {
576580
type: "module",
577581
},
@@ -1388,7 +1392,7 @@ gulp.task(
13881392
gulp.series(
13891393
createBuildNumber,
13901394
function scriptingMozcentral() {
1391-
const defines = { ...DEFINES, MOZCENTRAL: true };
1395+
const defines = { ...DEFINES, MOZCENTRAL: true, MINIFIED: true };
13921396
return buildDefaultPreferences(defines, "mozcentral/");
13931397
},
13941398
async function prefsMozcentral() {
@@ -1397,7 +1401,7 @@ gulp.task(
13971401
function createMozcentral() {
13981402
console.log();
13991403
console.log("### Building mozilla-central extension");
1400-
const defines = { ...DEFINES, MOZCENTRAL: true };
1404+
const defines = { ...DEFINES, MOZCENTRAL: true, MINIFIED: true };
14011405
const gvDefines = { ...defines, GECKOVIEW: true };
14021406

14031407
const MOZCENTRAL_DIR = BUILD_DIR + "mozcentral/",

0 commit comments

Comments
 (0)