Sfoglia il codice sorgente

chore: new webpack can omit redundant runtime

tophf 1 anno fa
parent
commit
66f3137ba9
2 ha cambiato i file con 4 aggiunte e 8 eliminazioni
  1. 2 0
      scripts/webpack-protect-bootstrap-plugin.js
  2. 2 8
      scripts/webpack-util.js

+ 2 - 0
scripts/webpack-protect-bootstrap-plugin.js

@@ -41,6 +41,7 @@ const MAIN_RULES = [
       `var (__webpack_module_cache__|${G.require}) = {};.*?`,
     ].join('|')})var ${G.exports} =`, 's'),
     patchBootstrap,
+    false,
   ], [
     new RegExp(`(${[
       `${G.definePropertyGetters}\\(${G.exports}, {`,
@@ -48,6 +49,7 @@ const MAIN_RULES = [
       `var __webpack_modules__ = \\({`,
     ].join('|')})(?!__proto__:)\\s*(.)`, 'g'),
     OBJ_RULE[1],
+    false,
   ],
 ];
 

+ 2 - 8
scripts/webpack-util.js

@@ -66,15 +66,9 @@ function addWrapperWithGlobals(name, config, defsObj, callback) {
     .replace(defsRe, s => defsObj[s])
   );
   const { header, footer, test } = callback(reader);
-  const opts = {
-    test,
-    banner: header,
-    entryOnly: true,
-    raw: true,
-  };
   config.plugins.push(
-    new webpack.BannerPlugin(opts),
-    new webpack.BannerPlugin({ ...opts, banner: footer, footer: true })
+    new webpack.BannerPlugin({ test, raw: true, banner: header }),
+    new webpack.BannerPlugin({ test, raw: true, banner: footer, footer: true })
   );
 }