This is very confusing as seen in #12974 or #12906. My suggestion would be "legacy."
.pipe(gulp.dest(DIST_DIR + "image_decoders/")),
        gulp
          .src(IMAGE_DECODERS_ES5_DIR + "**/*", {
            base: IMAGE_DECODERS_ES5_DIR,
          })
          .pipe(gulp.dest(DIST_DIR + "es5/image_decoders/")),
        gulp
          .src(LIB_DIR + "**/*", { base: LIB_DIR })
          .pipe(gulp.dest(DIST_DIR + "lib/")),
        gulp
          .src(TYPES_DIR + "**/*", { base: TYPES_DIR })
          .pipe(gulp.dest(DIST_DIR + "types/")),
      ]);
    }
  )
);
gulp.task(
  "dist-install",
  gulp.series("dist-pre", function (done) {
    var distPath = DIST_DIR;
    var opts = {};
    var installPath = process.env.PDFJS_INSTALL_PATH;
    if (installPath) {
      opts.cwd = installPath;
      distPath = path.relative(installPath, distPath);
    }
    safeSpawnSync("npm", ["install", distPath], opts);
    done();
  })
);