Skip to content

Commit

Permalink
fix: performance (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Dec 17, 2019
1 parent 0bc8435 commit d2acd75
Show file tree
Hide file tree
Showing 11 changed files with 293 additions and 238 deletions.
233 changes: 133 additions & 100 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
},
"dependencies": {
"cacache": "^13.0.1",
"find-cache-dir": "^3.1.0",
"find-cache-dir": "^3.2.0",
"jest-worker": "^24.9.0",
"schema-utils": "^2.6.1",
"serialize-javascript": "^2.1.2",
"source-map": "^0.6.1",
"terser": "^4.4.2",
"terser": "^4.4.3",
"webpack-sources": "^1.4.3"
},
"devDependencies": {
Expand Down Expand Up @@ -75,7 +75,7 @@
"prettier": "^1.19.1",
"standard-version": "^7.0.1",
"uglify-js": "^3.7.2",
"webpack": "^4.41.2"
"webpack": "^4.41.3"
},
"keywords": [
"uglify",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class TerserPlugin {
outputSource = new SourceMapSource(
code,
file,
JSON.parse(map),
map,
input,
inputSourceMap,
true
Expand Down
2 changes: 1 addition & 1 deletion src/minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const minify = (options) => {

// Let terser generate a SourceMap
if (inputSourceMap) {
terserOptions.sourceMap = true;
terserOptions.sourceMap = { asObject: true };
}

const extractedComments = [];
Expand Down
10 changes: 5 additions & 5 deletions test/__snapshots__/TerserPlugin.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ exports[`TerserPlugin buildWarning method 6`] = `null`;

exports[`TerserPlugin should regenerate hash: assets 1`] = `
Object {
"598.598.adacec1d4b95ace7be6c.js": "(window.webpackJsonp=window.webpackJsonp||[]).push([[598],{598:(s,n,p)=>{\\"use strict\\";p.r(n),p.d(n,{default:()=>w});const w=\\"async-dep\\"}}]);",
"AsyncImportExport.4bcf104b7d8f6724bcb1.js": "(()=>{\\"use strict\\";var e={},r={};function o(t){if(r[t])return r[t].exports;var n=r[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.m=e,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+\\".adacec1d4b95ace7be6c.js\\",o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),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 n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((o,t)=>{n=e[r]=[o,t]});t.push(n[2]=a);var i,s=o.p+o.u(r),u=document.createElement(\\"script\\");u.charset=\\"utf-8\\",u.timeout=120,o.nc&&u.setAttribute(\\"nonce\\",o.nc),u.src=s;var c=new Error;i=t=>{i=()=>{},u.onerror=u.onload=null,clearTimeout(d);var a=(()=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n))return n[1]})();if(a){var s=t&&(\\"load\\"===t.type?\\"missing\\":t.type),p=t&&t.target&&t.target.src;c.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+s+\\": \\"+p+\\")\\",c.name=\\"ChunkLoadError\\",c.type=s,c.request=p,a(c)}};var d=setTimeout(()=>{i({type:\\"timeout\\",target:u})},12e4);u.onerror=u.onload=i,document.head.appendChild(u)}};var r=window.webpackJsonp=window.webpackJsonp||[],t=r.push.bind(r);r.push=function(r){for(var t,a,i=r[0],s=r[1],u=r[3],c=0,d=[];c<i.length;c++)a=i[c],o.o(e,a)&&e[a]&&d.push(e[a][0]),e[a]=0;for(t in s)o.o(s,t)&&(o.m[t]=s[t]);for(u&&u(o),n&&n(r);d.length;)d.shift()()};var n=t})(),o.e(598).then(o.bind(o,598)).then(()=>{console.log(\\"Good\\")})})();",
"importExport.606e535d43da7b2fe202.js": "(()=>{\\"use strict\\"})();",
"js.15b3715400e117a4b40d.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.ffc31a45cf4ddfef05e5.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)})();",
"598.598.f269c88a2945c1fb29a1.js": "(window.webpackJsonp=window.webpackJsonp||[]).push([[598],{598:(s,n,p)=>{\\"use strict\\";p.r(n),p.d(n,{default:()=>w});const w=\\"async-dep\\"}}]);",
"AsyncImportExport.d603d450d8015887d00e.js": "(()=>{\\"use strict\\";var e={},r={};function o(t){if(r[t])return r[t].exports;var n=r[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.m=e,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+\\".f269c88a2945c1fb29a1.js\\",o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),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 n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((o,t)=>{n=e[r]=[o,t]});t.push(n[2]=a);var i,s=o.p+o.u(r),u=document.createElement(\\"script\\");u.charset=\\"utf-8\\",u.timeout=120,o.nc&&u.setAttribute(\\"nonce\\",o.nc),u.src=s;var p=new Error;i=t=>{i=()=>{},u.onerror=u.onload=null,clearTimeout(c);var a=(()=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n))return n[1]})();if(a){var s=t&&(\\"load\\"===t.type?\\"missing\\":t.type),d=t&&t.target&&t.target.src;p.message=\\"Loading chunk \\"+r+\\" failed.\\\\n(\\"+s+\\": \\"+d+\\")\\",p.name=\\"ChunkLoadError\\",p.type=s,p.request=d,a(p)}};var c=setTimeout(()=>{i({type:\\"timeout\\",target:u})},12e4);u.onerror=u.onload=i,document.head.appendChild(u)}};var r=window.webpackJsonp=window.webpackJsonp||[],t=r.push.bind(r);r.push=function(r){for(var t,a,i=r[0],s=r[1],u=r[3],p=0,c=[];p<i.length;p++)a=i[p],o.o(e,a)&&e[a]&&c.push(e[a][0]),e[a]=0;for(t in s)o.o(s,t)&&(o.m[t]=s[t]);for(u&&u(o),n&&n(r);c.length;)c.shift()()};var n=t})(),o.e(598).then(o.bind(o,598)).then(()=>{console.log(\\"Good\\")})})();",
"importExport.8deb6b94a7f006da83b9.js": "(()=>{\\"use strict\\"})();",
"js.0ec4c136cd66a3cda54a.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.d62bda6aebbfc0328d92.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
Loading

0 comments on commit d2acd75

Please sign in to comment.