Only ignore the src/core/{glyphlist, unicode}.js
files, during building of pdf.worker.js
, when source-maps are enabled
This produces a slightly smaller built `pdf.worker.js` file, for e.g. the `gulp mozcentral` build-target.
This commit is contained in:
parent
56fa6d414c
commit
126f42a266
19
gulpfile.js
19
gulpfile.js
@ -185,6 +185,19 @@ function createWebpackConfig(defines, output) {
|
|||||||
!bundleDefines.TESTING;
|
!bundleDefines.TESTING;
|
||||||
var skipBabel = bundleDefines.SKIP_BABEL;
|
var skipBabel = bundleDefines.SKIP_BABEL;
|
||||||
|
|
||||||
|
// `core-js` (see https://github.com/zloirock/core-js/issues/514),
|
||||||
|
// `web-streams-polyfill` (already using a transpiled file), and
|
||||||
|
// `src/core/{glyphlist,unicode}.js` (Babel is too slow for those when
|
||||||
|
// source-maps are enabled) should be excluded from processing.
|
||||||
|
const babelExcludes = [
|
||||||
|
"node_modules[\\\\\\/]core-js",
|
||||||
|
"node_modules[\\\\\\/]web-streams-polyfill",
|
||||||
|
];
|
||||||
|
if (enableSourceMaps) {
|
||||||
|
babelExcludes.push("src[\\\\\\/]core[\\\\\\/](glyphlist|unicode)");
|
||||||
|
}
|
||||||
|
const babelExcludeRegExp = new RegExp(`(${babelExcludes.join("|")})`);
|
||||||
|
|
||||||
// Required to expose e.g., the `window` object.
|
// Required to expose e.g., the `window` object.
|
||||||
output.globalObject = "this";
|
output.globalObject = "this";
|
||||||
|
|
||||||
@ -209,11 +222,7 @@ function createWebpackConfig(defines, output) {
|
|||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
loader: "babel-loader",
|
loader: "babel-loader",
|
||||||
// `core-js` (see https://github.com/zloirock/core-js/issues/514),
|
exclude: babelExcludeRegExp,
|
||||||
// `web-streams-polyfill` (already using a transpiled file), and
|
|
||||||
// `src/core/{glyphlist,unicode}.js` (Babel is too slow for those)
|
|
||||||
// should be excluded from processing.
|
|
||||||
exclude: /(node_modules[\\\/]core-js|node_modules[\\\/]web-streams-polyfill|src[\\\/]core[\\\/](glyphlist|unicode))/,
|
|
||||||
options: {
|
options: {
|
||||||
presets: skipBabel ? undefined : ["@babel/preset-env"],
|
presets: skipBabel ? undefined : ["@babel/preset-env"],
|
||||||
plugins: [
|
plugins: [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user