Skip to content

Commit

Permalink
fix: uglify additional assets
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Jul 16, 2020
1 parent f5fa845 commit 100e38e
Show file tree
Hide file tree
Showing 9 changed files with 2,008 additions and 2,156 deletions.
3,758 changes: 1,780 additions & 1,978 deletions package-lock.json

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,30 @@
"webpack": "^4.0.0 || ^5.0.0"
},
"dependencies": {
"cacache": "^15.0.4",
"cacache": "^15.0.5",
"find-cache-dir": "^3.3.1",
"jest-worker": "^26.0.0",
"p-limit": "^3.0.1",
"jest-worker": "^26.1.0",
"p-limit": "^3.0.2",
"schema-utils": "^2.6.6",
"serialize-javascript": "^4.0.0",
"source-map": "^0.6.1",
"terser": "^4.8.0",
"webpack-sources": "^1.4.3"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/preset-env": "^7.10.4",
"@commitlint/cli": "^9.1.2",
"@commitlint/config-conventional": "^9.1.1",
"@webpack-contrib/defaults": "^6.3.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^26.0.1",
"babel-jest": "^26.1.0",
"copy-webpack-plugin": "^6.0.3",
"cross-env": "^7.0.2",
"del": "^5.1.0",
"del-cli": "^3.0.1",
"eslint": "^7.2.0",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.2",
"file-loader": "^6.0.0",
Expand All @@ -73,8 +74,8 @@
"memfs": "^3.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"standard-version": "^8.0.0",
"uglify-js": "^3.9.3",
"standard-version": "^8.0.2",
"uglify-js": "^3.10.0",
"webpack": "^4.43.0"
},
"keywords": [
Expand Down
14 changes: 8 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,13 @@ class TerserPlugin {
this.options.terserOptions.ecma = output.ecmaVersion;
}

const optimizeFn = async (compilation, chunksOrAssets) => {
const matchObject = ModuleFilenameHelpers.matchObject.bind(
// eslint-disable-next-line no-undefined
undefined,
this.options
);
const matchObject = ModuleFilenameHelpers.matchObject.bind(
// eslint-disable-next-line no-undefined
undefined,
this.options
);

const optimizeFn = async (compilation, chunksOrAssets) => {
let assetNames;

if (TerserPlugin.isWebpack4()) {
Expand All @@ -580,6 +580,8 @@ class TerserPlugin {
[]
)
)
.concat(Object.keys(compilation.assets))
.filter((file, index, assets) => assets.indexOf(file) === index)
.filter((file) => matchObject(file));
} else {
assetNames = []
Expand Down
20 changes: 20 additions & 0 deletions test/TerserPlugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import crypto from 'crypto';

import path from 'path';

import CopyWebpackPlugin from 'copy-webpack-plugin';
import RequestShortener from 'webpack/lib/RequestShortener';
import { javascript } from 'webpack';
import MainTemplate from 'webpack/lib/MainTemplate';
Expand Down Expand Up @@ -803,4 +804,23 @@ describe('TerserPlugin', () => {
process.stdout.write = stdoutWrite;
process.stderr.write = stderrWrite;
});

it('should work with "copy-webpack-plugin"', async () => {
const compiler = getCompiler();

new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, './fixtures/copy.js'),
},
],
}).apply(compiler);
new TerserPlugin().apply(compiler);

const stats = await compile(compiler);

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getErrors(stats)).toMatchSnapshot('errors');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
});
});
16 changes: 13 additions & 3 deletions test/__snapshots__/TerserPlugin.test.js.snap.webpack4
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ exports[`TerserPlugin should work in multi compiler mode: warnings 3`] = `Array

exports[`TerserPlugin should work when some of assets do not contain source maps: assets 1`] = `
Object {
"extra-file.js": "var a = 1; console.log(a);",
"extra-file.js": "var a=1;console.log(a);",
"main.js": "!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&\\"object\\"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,\\"default\\",{enumerable:!0,value:e}),2&t&&\\"string\\"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,\\"a\\",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=\\"\\",n(n.s=0)}([function(e,t){e.exports=function(){console.log(7)}}]);
//# sourceMappingURL=main.js.map",
"main.js.map": "{\\"version\\":3,\\"sources\\":[\\"webpack:///webpack/bootstrap\\",\\"webpack:///./test/fixtures/entry.js\\"],\\"names\\":[\\"installedModules\\",\\"__webpack_require__\\",\\"moduleId\\",\\"exports\\",\\"module\\",\\"i\\",\\"l\\",\\"modules\\",\\"call\\",\\"m\\",\\"c\\",\\"d\\",\\"name\\",\\"getter\\",\\"o\\",\\"Object\\",\\"defineProperty\\",\\"enumerable\\",\\"get\\",\\"r\\",\\"Symbol\\",\\"toStringTag\\",\\"value\\",\\"t\\",\\"mode\\",\\"__esModule\\",\\"ns\\",\\"create\\",\\"key\\",\\"bind\\",\\"n\\",\\"object\\",\\"property\\",\\"prototype\\",\\"hasOwnProperty\\",\\"p\\",\\"s\\",\\"console\\",\\"log\\",\\"b\\"],\\"mappings\\":\\"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,G,gBC7ErDhC,EAAOD,QAAU,WAEfkC,QAAQC,IAAIC\\",\\"file\\":\\"main.js\\",\\"sourcesContent\\":[\\" \\\\t// The module cache\\\\n \\\\tvar installedModules = {};\\\\n\\\\n \\\\t// The require function\\\\n \\\\tfunction __webpack_require__(moduleId) {\\\\n\\\\n \\\\t\\\\t// Check if module is in cache\\\\n \\\\t\\\\tif(installedModules[moduleId]) {\\\\n \\\\t\\\\t\\\\treturn installedModules[moduleId].exports;\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\t// Create a new module (and put it into the cache)\\\\n \\\\t\\\\tvar module = installedModules[moduleId] = {\\\\n \\\\t\\\\t\\\\ti: moduleId,\\\\n \\\\t\\\\t\\\\tl: false,\\\\n \\\\t\\\\t\\\\texports: {}\\\\n \\\\t\\\\t};\\\\n\\\\n \\\\t\\\\t// Execute the module function\\\\n \\\\t\\\\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\\\\n\\\\n \\\\t\\\\t// Flag the module as loaded\\\\n \\\\t\\\\tmodule.l = true;\\\\n\\\\n \\\\t\\\\t// Return the exports of the module\\\\n \\\\t\\\\treturn module.exports;\\\\n \\\\t}\\\\n\\\\n\\\\n \\\\t// expose the modules object (__webpack_modules__)\\\\n \\\\t__webpack_require__.m = modules;\\\\n\\\\n \\\\t// expose the module cache\\\\n \\\\t__webpack_require__.c = installedModules;\\\\n\\\\n \\\\t// define getter function for harmony exports\\\\n \\\\t__webpack_require__.d = function(exports, name, getter) {\\\\n \\\\t\\\\tif(!__webpack_require__.o(exports, name)) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\\\\n \\\\t\\\\t}\\\\n \\\\t};\\\\n\\\\n \\\\t// define __esModule on exports\\\\n \\\\t__webpack_require__.r = function(exports) {\\\\n \\\\t\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n \\\\t\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n \\\\t\\\\t}\\\\n \\\\t\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n \\\\t};\\\\n\\\\n \\\\t// create a fake namespace object\\\\n \\\\t// mode & 1: value is a module id, require it\\\\n \\\\t// mode & 2: merge all properties of value into the ns\\\\n \\\\t// mode & 4: return value when already ns object\\\\n \\\\t// mode & 8|1: behave like require\\\\n \\\\t__webpack_require__.t = function(value, mode) {\\\\n \\\\t\\\\tif(mode & 1) value = __webpack_require__(value);\\\\n \\\\t\\\\tif(mode & 8) return value;\\\\n \\\\t\\\\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\\\\n \\\\t\\\\tvar ns = Object.create(null);\\\\n \\\\t\\\\t__webpack_require__.r(ns);\\\\n \\\\t\\\\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\\\\n \\\\t\\\\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\\\\n \\\\t\\\\treturn ns;\\\\n \\\\t};\\\\n\\\\n \\\\t// getDefaultExport function for compatibility with non-harmony modules\\\\n \\\\t__webpack_require__.n = function(module) {\\\\n \\\\t\\\\tvar getter = module && module.__esModule ?\\\\n \\\\t\\\\t\\\\tfunction getDefault() { return module['default']; } :\\\\n \\\\t\\\\t\\\\tfunction getModuleExports() { return module; };\\\\n \\\\t\\\\t__webpack_require__.d(getter, 'a', getter);\\\\n \\\\t\\\\treturn getter;\\\\n \\\\t};\\\\n\\\\n \\\\t// Object.prototype.hasOwnProperty.call\\\\n \\\\t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\\\\n\\\\n \\\\t// __webpack_public_path__\\\\n \\\\t__webpack_require__.p = \\\\\\"\\\\\\";\\\\n\\\\n\\\\n \\\\t// Load entry module and return exports\\\\n \\\\treturn __webpack_require__(__webpack_require__.s = 0);\\\\n\\",\\"// foo\\\\n/* @preserve*/\\\\n// bar\\\\nconst a = 2 + 2;\\\\n\\\\nmodule.exports = function Foo() {\\\\n const b = 2 + 2;\\\\n console.log(b + 1 + 2);\\\\n};\\\\n\\"],\\"sourceRoot\\":\\"\\"}",
Expand All @@ -575,11 +575,21 @@ exports[`TerserPlugin should work when some of assets do not contain source maps

exports[`TerserPlugin should work when some of assets do not contain source maps: warnings 1`] = `Array []`;

exports[`TerserPlugin should work with "copy-webpack-plugin": assets 1`] = `
Object {
"copy.js": "var foo=12;console.log(foo);",
"main.js": "!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&\\"object\\"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,\\"default\\",{enumerable:!0,value:e}),2&t&&\\"string\\"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,\\"a\\",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=\\"\\",n(n.s=0)}([function(e,t){e.exports=function(){console.log(7)}}]);",
}
`;

exports[`TerserPlugin should work with "copy-webpack-plugin": errors 1`] = `Array []`;

exports[`TerserPlugin should work with "copy-webpack-plugin": warnings 1`] = `Array []`;

exports[`TerserPlugin should work with "file-loader": assets 1`] = `
Object {
"main.js": "!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&\\"object\\"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,\\"default\\",{enumerable:!0,value:e}),2&t&&\\"string\\"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,\\"a\\",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p=\\"\\",r(r.s=0)}([function(e,t,r){\\"use strict\\";r.r(t);var n=r.p+\\"test/fixtures/emitted.js\\";console.log(12,n);t.default=12}]);",
"test/fixtures/emitted.js": "console.log('HERE');
",
"test/fixtures/emitted.js": "console.log(\\"HERE\\");",
}
`;

Expand Down
17 changes: 14 additions & 3 deletions test/__snapshots__/TerserPlugin.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ exports[`TerserPlugin should emit an error on a broken code in parallel mode: wa
exports[`TerserPlugin should regenerate hash: assets 1`] = `
Object {
"598.598.70ff6985755ae80c6ef7.js": "(window.webpackJsonpterser_webpack_plugin=window.webpackJsonpterser_webpack_plugin||[]).push([[598],{598:(e,p,s)=>{\\"use strict\\";s.r(p),s.d(p,{default:()=>n});const n=\\"async-dep\\"}}]);",
"AsyncImportExport.aa25d3131bd99b7ed107.js": "(()=>{\\"use strict\\";var e,t={},r={};function o(e){if(r[e])return r[e].exports;var a=r[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>e+\\".\\"+e+\\".70ff6985755ae80c6ef7.js\\",o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},o.l=(t,r,a)=>{if(e[t])e[t].push(r);else{var n,i;if(void 0!==a)for(var s=document.getElementsByTagName(\\"script\\"),u=0;u<s.length;u++){var p=s[u];if(p.getAttribute(\\"src\\")==t||p.getAttribute(\\"data-webpack\\")==a){n=p;break}}n||(i=!0,(n=document.createElement(\\"script\\")).charset=\\"utf-8\\",n.timeout=120,o.nc&&n.setAttribute(\\"nonce\\",o.nc),n.setAttribute(\\"data-webpack\\",a),n.src=t),e[t]=[r];var c=r=>{c=()=>{},n.onerror=n.onload=null,clearTimeout(l);var o=e[t];delete e[t],n.parentNode.removeChild(n),o&&o.forEach(e=>e(r))},l=setTimeout(()=>{c({type:\\"timeout\\",target:n})},12e4);n.onerror=n.onload=c,i&&document.head.appendChild(n)}},o.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},o.p=\\"\\",(()=>{var e={988:0};o.f.j=(t,r)=>{var a=o.o(e,t)?e[t]:void 0;if(0!==a)if(a)r.push(a[2]);else{var n=new Promise((r,o)=>{a=e[t]=[r,o]});r.push(a[2]=n);var i=o.p+o.u(t),s=new Error;o.l(i,r=>{if(o.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var n=r&&(\\"load\\"===r.type?\\"missing\\":r.type),i=r&&r.target&&r.target.src;s.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+n+\\": \\"+i+\\")\\",s.name=\\"ChunkLoadError\\",s.type=n,s.request=i,a[1](s)}},\\"chunk-\\"+t)}};var t=window.webpackJsonpterser_webpack_plugin=window.webpackJsonpterser_webpack_plugin||[],r=t.push.bind(t);t.push=function(t){for(var r,n,i=t[0],s=t[1],u=t[3],p=0,c=[];p<i.length;p++)n=i[p],o.o(e,n)&&e[n]&&c.push(e[n][0]),e[n]=0;for(r in s)o.o(s,r)&&(o.m[r]=s[r]);for(u&&u(o),a&&a(t);c.length;)c.shift()()};var a=r})(),o.e(598).then(o.bind(o,598)).then(()=>{console.log(\\"Good\\")})})();",
"AsyncImportExport.853ebc7a6b79b4a9b16b.js": "(()=>{\\"use strict\\";var e,r={},t={};function o(e){if(t[e])return t[e].exports;var a=t[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((r,t)=>(o.f[t](e,r),r),[])),o.u=e=>e+\\".\\"+e+\\".70ff6985755ae80c6ef7.js\\",o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},o.l=(r,t,a)=>{if(e[r])e[r].push(t);else{var n,i;if(void 0!==a)for(var p=document.getElementsByTagName(\\"script\\"),s=0;s<p.length;s++){var u=p[s];if(u.getAttribute(\\"src\\")==r||u.getAttribute(\\"data-webpack\\")==\\"terser-webpack-plugin:\\"+a){n=u;break}}n||(i=!0,(n=document.createElement(\\"script\\")).charset=\\"utf-8\\",n.timeout=120,o.nc&&n.setAttribute(\\"nonce\\",o.nc),n.setAttribute(\\"data-webpack\\",\\"terser-webpack-plugin:\\"+a),n.src=r),e[r]=[t];var c=t=>{c=()=>{},n.onerror=n.onload=null,clearTimeout(l);var o=e[r];delete e[r],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(t))},l=setTimeout(()=>{c({type:\\"timeout\\",target:n})},12e4);n.onerror=n.onload=c,i&&document.head.appendChild(n)}},o.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})},o.p=\\"\\",(()=>{var e={988:0};o.f.j=(r,t)=>{var a=o.o(e,r)?e[r]:void 0;if(0!==a)if(a)t.push(a[2]);else{var n=new Promise((t,o)=>{a=e[r]=[t,o]});t.push(a[2]=n);var i=o.p+o.u(r),p=new Error;o.l(i,t=>{if(o.o(e,r)&&(0!==(a=e[r])&&(e[r]=void 0),a)){var n=t&&(\\"load\\"===t.type?\\"missing\\":t.type),i=t&&t.target&&t.target.src;p.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+n+\\": \\"+i+\\")\\",p.name=\\"ChunkLoadError\\",p.type=n,p.request=i,a[1](p)}},\\"chunk-\\"+r)}};var r=window.webpackJsonpterser_webpack_plugin=window.webpackJsonpterser_webpack_plugin||[],t=r.push.bind(r);r.push=function(r){for(var t,n,i=r[0],p=r[1],s=r[3],u=0,c=[];u<i.length;u++)n=i[u],o.o(e,n)&&e[n]&&c.push(e[n][0]),e[n]=0;for(t in p)o.o(p,t)&&(o.m[t]=p[t]);for(s&&s(o),a&&a(r);c.length;)c.shift()()};var a=t})(),o.e(598).then(o.bind(o,598)).then(()=>{console.log(\\"Good\\")})})();",
"importExport.4dbd083d0540b53c8bf4.js": "(()=>{\\"use strict\\"})();",
"js.d1bc0c3718c3f8ac4e41.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
"mjs.2b79abcd1a51a2d3d42f.js": "(()=>{var r={631:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(631)})();",
Expand Down Expand Up @@ -314,7 +314,7 @@ Object {
"assetEmitted": 0,
"beforeCompile": 0,
"beforeRun": 1,
"compilation": 48,
"compilation": 51,
"compile": 0,
"contextModuleFactory": 0,
"done": 1,
Expand Down Expand Up @@ -428,7 +428,7 @@ Object {
"assetEmitted": 0,
"beforeCompile": 0,
"beforeRun": 1,
"compilation": 48,
"compilation": 51,
"compile": 0,
"contextModuleFactory": 0,
"done": 1,
Expand Down Expand Up @@ -486,6 +486,17 @@ exports[`TerserPlugin should work with "asset" module type: errors 1`] = `Array

exports[`TerserPlugin should work with "asset" module type: warnings 1`] = `Array []`;

exports[`TerserPlugin should work with "copy-webpack-plugin": assets 1`] = `
Object {
"copy.js": "var foo=12;console.log(foo);",
"main.js": "(()=>{var r={791:r=>{r.exports=function(){console.log(7)}}},o={};!function t(e){if(o[e])return o[e].exports;var n=o[e]={exports:{}};return r[e](n,n.exports,t),n.exports}(791)})();",
}
`;

exports[`TerserPlugin should work with "copy-webpack-plugin": errors 1`] = `Array []`;

exports[`TerserPlugin should work with "copy-webpack-plugin": warnings 1`] = `Array []`;

exports[`TerserPlugin should work with "file-loader": assets 1`] = `
Object {
"main.js": "(()=>{\\"use strict\\";var t={p:\\"\\"};const s=t.p+\\"test/fixtures/emitted.js\\";console.log(12,s)})();",
Expand Down
Loading

3 comments on commit 100e38e

@fregante
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have an option to disable it? More info: refined-github/refined-github#3451 (review)

@alexander-akait
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fregante You have exclude option if you need to exclude some assets

@fregante
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Please sign in to comment.