1:HL["/_next/static/css/275839517c59c532.css",{"as":"style"}] 2:HL["/_next/static/css/bdb880d990e879b6.css",{"as":"style"}] 0:[[["",{"children":["post",{"children":[["slug","gulp-uglify-es6-babel","d"],{"children":["__PAGE__?{\"slug\":\"gulp-uglify-es6-babel\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/275839517c59c532.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/bdb880d990e879b6.css","precedence":"next"}]],["$L4",null]]]] 5:HL["/_next/static/css/95c7fb627fba8423.css",{"as":"style"}] 6:HL["/_next/static/css/477df780fc5cb593.css",{"as":"style"}] 7:HL["/_next/static/css/c40a92e7f996f910.css",{"as":"style"}] 3:["$L8",null] 4:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"Gulp 用 Babel 降级的方式 uglify ES6 JavaScript"}],["$","meta","2",{"name":"description","content":"Gulp 用 Babel 降级的方式 uglify ES6 JavaScript"}],["$","link","3",{"rel":"manifest","href":"/manifest.json"}],["$","meta","4",{"name":"generator","content":"Hexo.js & Next.js"}],["$","meta","5",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","6",{"property":"og:title","content":"Gulp 用 Babel 降级的方式 uglify ES6 JavaScript"}],["$","meta","7",{"property":"og:description","content":"Gulp 用 Babel 降级的方式 uglify ES6 JavaScript"}],["$","meta","8",{"name":"twitter:card","content":"summary"}],["$","meta","9",{"name":"twitter:title","content":"Gulp 用 Babel 降级的方式 uglify ES6 JavaScript"}],["$","meta","10",{"name":"twitter:description","content":"Gulp 用 Babel 降级的方式 uglify ES6 JavaScript"}]] 9:I{"id":"7477","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","859:static/chunks/859-ea023633456a13f8.js","355:static/chunks/app/tags/[slug]/page-257dc97429efd72a.js"],"name":"","async":false} a:I{"id":"92","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","92:static/chunks/92-371a458fbe090447.js","284:static/chunks/284-b1d21b691d3eabee.js","605:static/chunks/app/post/[slug]/page-0339b76e369b6af8.js"],"name":"","async":false} b:I{"id":"2449","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","92:static/chunks/92-371a458fbe090447.js","185:static/chunks/app/layout-4eab34e1c4d9af8d.js"],"name":"","async":false} c:I{"id":"3211","chunks":["272:static/chunks/webpack-7471fa70de6bdb29.js","253:static/chunks/bce60fc1-2413e66000a5dd8f.js","769:static/chunks/769-2bf088c0a421e73d.js"],"name":"","async":false} d:I{"id":"5767","chunks":["272:static/chunks/webpack-7471fa70de6bdb29.js","253:static/chunks/bce60fc1-2413e66000a5dd8f.js","769:static/chunks/769-2bf088c0a421e73d.js"],"name":"","async":false} f:I{"id":"6424","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","92:static/chunks/92-371a458fbe090447.js","185:static/chunks/app/layout-4eab34e1c4d9af8d.js"],"name":"GaLite","async":false} 10:I{"id":"9869","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","92:static/chunks/92-371a458fbe090447.js","185:static/chunks/app/layout-4eab34e1c4d9af8d.js"],"name":"SpeedInsights","async":false} 11:I{"id":"7148","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","92:static/chunks/92-371a458fbe090447.js","185:static/chunks/app/layout-4eab34e1c4d9af8d.js"],"name":"Analytics","async":false} 8:["$","html",null,{"lang":"zh-CN","children":[["$","link",null,{"rel":"icon","href":"/images/icons/icon-72x72.png","type":"image/x-icon"}],["$","link",null,{"rel":"preconnect","href":"https://vip2.loli.io"}],["$","link",null,{"rel":"dns-prefetch","href":"https://vip2.loli.io"}],["$","link",null,{"rel":"alternate","type":"application/atom+xml","href":"/atom.xml"}],["$","body",null,{"children":["$","div",null,{"className":"kbCXHY jdraHW eqrBPF kEFtPS bNzOWQ juexza kXMrYr ","children":[["$","header",null,{"className":"doNOqr WhAZY cRUUAa cwMEsi dpJmjl bsTuZj iRietU JCsMI fONtwf eEsPgn gWUoqV kazZiE fsKTUV dkPCxO gdGTeM ","children":[["$","div",null,{"className":"doNOqr WhAZY hrtgtE iYRJzs iJGxaV jlwzhw ","children":[["$","$L9",null,{"className":"icyDkI gSBWlu foGVKH IVbXa kooHYa JxWnH cVJMrm hyoqRt jlijat kUpitc gdtkYW iDPWLw kayxZK hCkclF cneMsd gYPNzh ","href":"/","children":[["$","div",null,{"className":"eSltVp cpOcAb caItCN cyerGB dSxtaa lbEyiT kUPESX Pmecg ldtSOY ","children":["$","$La",null,{"src":"https://vip2.loli.io/2023/03/09/2tAMcy694lE3IZX.jpg","blurDataURL":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAIAAAACDbGyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAW0lEQVR4nAFQAK//AAAAAA0MCD08JoiyXkqWNQBPSDHtwYf/86ehuWNAeS4Aep9O+bt9/9aWxbtzETMSAClqHld9MqambcuqdgMOAwBCaS1Mdzd/hFE4PCMEEAS4ex049PWXOAAAAABJRU5ErkJggg==","alt":"avatar","width":200,"height":200,"layout":"responsive","className":"jWjrEQ eKtERL BRobm iovjFN ","placeholder":"blur","priority":true}]}],["$","h1",null,{"className":"evYdWj cpOcAb XEVlt huiurs ","children":"fengkx's Blog"}]]}],["$","h2",null,{"id":"name","className":"hrtgtE fcXWHl ","children":"fengkx"}],["$","h3",null,{"id":"title","className":"hrtgtE fcXWHl ","children":"Student & Coder"}],["$","div",null,{"className":"fONtwf fcXWHl foGVKH IVbXa dPVLzs fkrGAA cvCecb jJGIjV ","children":[["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","children":["$undefined",[["$","path","0",{"d":"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z","children":"$undefined"}],["$","circle","1",{"cx":"12","cy":"10","r":"3","children":"$undefined"}]]],"className":"$undefined","style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}],["$","span",null,{"className":"gUpJEt ","children":"Guangzhou, China"}]]}],["$","nav",null,{"className":"hrtgtE jlwzhw gSBWlu IVbXa kKRHCo jzaqKj ehqwGF ","children":[["$","div",null,{"className":"kooHYa ","children":["$","$L9",null,{"className":"gSBWlu foGVKH fPWmiY JxWnH cVJMrm OqOoD jJbtJp ihIJmy bgUfpT AsNjI kwISoH gdPTUr eLDTYY dmKgnC dPFrWx bmQfsF krqYva kXurrt ","href":"/","children":[["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","className":"jJhMtm fcXWHl gdPTUr dCiVRS TTRIX ","children":["$undefined",[["$","path","0",{"d":"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z","children":"$undefined"}],["$","polyline","1",{"points":"9 22 9 12 15 12 15 22","children":"$undefined"}]]],"style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}],["$","span",null,{"className":"","children":"首页"}]]}]}],["$","div",null,{"className":"kooHYa ","children":["$","$L9",null,{"className":"gSBWlu foGVKH fPWmiY JxWnH cVJMrm OqOoD jJbtJp ihIJmy bgUfpT AsNjI kwISoH gdPTUr eLDTYY dmKgnC dPFrWx bmQfsF krqYva kXurrt ","href":"/archives","children":[["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","className":"jJhMtm fcXWHl gdPTUr dCiVRS TTRIX ","children":["$undefined",[["$","polyline","0",{"points":"21 8 21 21 3 21 3 8","children":"$undefined"}],["$","rect","1",{"x":"1","y":"3","width":"22","height":"5","children":"$undefined"}],["$","line","2",{"x1":"10","y1":"12","x2":"14","y2":"12","children":"$undefined"}]]],"style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}],["$","span",null,{"className":"","children":"归档"}]]}]}],["$","div",null,{"className":"kooHYa ","children":["$","$L9",null,{"className":"gSBWlu foGVKH fPWmiY JxWnH cVJMrm OqOoD jJbtJp ihIJmy bgUfpT AsNjI kwISoH gdPTUr eLDTYY dmKgnC dPFrWx bmQfsF krqYva kXurrt ","href":"/tags","children":[["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","className":"jJhMtm fcXWHl gdPTUr dCiVRS TTRIX ","children":["$undefined",[["$","path","0",{"d":"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z","children":"$undefined"}],["$","line","1",{"x1":"7","y1":"7","x2":"7.01","y2":"7","children":"$undefined"}]]],"style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}],["$","span",null,{"className":"","children":"标签"}]]}]}],["$","div",null,{"className":"kooHYa ","children":["$","$L9",null,{"className":"gSBWlu foGVKH fPWmiY JxWnH cVJMrm OqOoD jJbtJp ihIJmy bgUfpT AsNjI kwISoH gdPTUr eLDTYY dmKgnC dPFrWx bmQfsF krqYva kXurrt ","href":"/links","children":[["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","className":"jJhMtm fcXWHl gdPTUr dCiVRS TTRIX ","children":["$undefined",[["$","path","0",{"d":"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2","children":"$undefined"}],["$","circle","1",{"cx":"9","cy":"7","r":"4","children":"$undefined"}],["$","path","2",{"d":"M23 21v-2a4 4 0 0 0-3-3.87","children":"$undefined"}],["$","path","3",{"d":"M16 3.13a4 4 0 0 1 0 7.75","children":"$undefined"}]]],"style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}],["$","span",null,{"className":"","children":"友链"}]]}]}],["$","div",null,{"className":"kooHYa ","children":["$","$L9",null,{"className":"gSBWlu foGVKH fPWmiY JxWnH cVJMrm OqOoD jJbtJp ihIJmy bgUfpT AsNjI kwISoH gdPTUr eLDTYY dmKgnC dPFrWx bmQfsF krqYva kXurrt ","href":"/about","children":[["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","className":"jJhMtm fcXWHl gdPTUr dCiVRS TTRIX ","children":["$undefined",[["$","path","0",{"d":"M18 8h1a4 4 0 0 1 0 8h-1","children":"$undefined"}],["$","path","1",{"d":"M2 8h16v9a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V8z","children":"$undefined"}],["$","line","2",{"x1":"6","y1":"1","x2":"6","y2":"4","children":"$undefined"}],["$","line","3",{"x1":"10","y1":"1","x2":"10","y2":"4","children":"$undefined"}],["$","line","4",{"x1":"14","y1":"1","x2":"14","y2":"4","children":"$undefined"}]]],"style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}],["$","span",null,{"className":"","children":"关于"}]]}]}],["$","div",null,{"className":"kooHYa ","children":["$","$L9",null,{"className":"gSBWlu foGVKH fPWmiY JxWnH cVJMrm OqOoD jJbtJp ihIJmy bgUfpT AsNjI kwISoH gdPTUr eLDTYY dmKgnC dPFrWx bmQfsF krqYva kXurrt ","href":"/search","children":[["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","className":"cpOcAb gdPTUr dCiVRS TTRIX ","children":["$undefined",[["$","circle","0",{"cx":"11","cy":"11","r":"8","children":"$undefined"}],["$","line","1",{"x1":"21","y1":"21","x2":"16.65","y2":"16.65","children":"$undefined"}]]],"style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}],["$","span",null,{"className":"jJhMtm fcXWHl ","children":"搜索"}]]}]}],["$","div",null,{"className":"kooHYa evYdWj ","children":["$","$L9",null,{"className":"gSBWlu foGVKH fPWmiY JxWnH cVJMrm OqOoD jJbtJp ihIJmy bgUfpT AsNjI kwISoH gdPTUr eLDTYY dmKgnC dPFrWx bmQfsF krqYva kXurrt ","href":"/atom.xml","prefetch":false,"children":[["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","className":"cpOcAb gdPTUr dCiVRS TTRIX ","children":["$undefined",[["$","path","0",{"d":"M4 11a9 9 0 0 1 9 9","children":"$undefined"}],["$","path","1",{"d":"M4 4a16 16 0 0 1 16 16","children":"$undefined"}],["$","circle","2",{"cx":"5","cy":"19","r":"1","children":"$undefined"}]]],"style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}],["$","span",null,{"className":"jJhMtm fcXWHl ","children":"RSS"}]]}]}]]}]]}],["$","div",null,{"className":"doNOqr hrtgtE fcXWHl iigETV bMSzLf XEVlt jmezSN izetJs kdrTtD bLIxaN ","children":[["$","div",null,{"className":"iLYBKc gSBWlu zEGrF evYWGf hDdCaA ","children":[["$","$L9",null,{"title":"fengkx's GitHub","href":"https://github.com/fengkx","prefetch":false,"children":["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","children":["$undefined",[["$","path","0",{"d":"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22","children":"$undefined"}]]],"className":"$undefined","style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}]}],["$","$L9",null,{"title":"fengkx's Telegram","href":"https://t.me/fengkx","prefetch":false,"children":["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","children":["$undefined",[["$","line","0",{"x1":"22","y1":"2","x2":"11","y2":"13","children":"$undefined"}],["$","polygon","1",{"points":"22 2 15 22 11 13 2 9 22 2","children":"$undefined"}]]],"className":"$undefined","style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}]}],["$","$L9",null,{"href":"https://mstdn.social/@fengkx","rel":"me","prefetch":false,"children":["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","children":["$undefined",[["$","path","0",{"stroke":"none","d":"M0 0h24v24H0z","fill":"none","children":"$undefined"}],["$","path","1",{"d":"M18.648 15.254c-1.816 1.763 -6.648 1.626 -6.648 1.626a18.262 18.262 0 0 1 -3.288 -.256c1.127 1.985 4.12 2.81 8.982 2.475c-1.945 2.013 -13.598 5.257 -13.668 -7.636l-.026 -1.154c0 -3.036 .023 -4.115 1.352 -5.633c1.671 -1.91 6.648 -1.666 6.648 -1.666s4.977 -.243 6.648 1.667c1.329 1.518 1.352 2.597 1.352 5.633s-.456 4.074 -1.352 4.944z","children":"$undefined"}],["$","path","2",{"d":"M12 11.204v-2.926c0 -1.258 -.895 -2.278 -2 -2.278s-2 1.02 -2 2.278v4.722m4 -4.722c0 -1.258 .895 -2.278 2 -2.278s2 1.02 2 2.278v4.722","children":"$undefined"}]]],"className":"$undefined","style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}]}],["$","$L9",null,{"title":"RSS feed","href":"/atom.xml","prefetch":false,"children":["$","svg",null,{"stroke":"currentColor","fill":"none","strokeWidth":"2","viewBox":"0 0 24 24","strokeLinecap":"round","strokeLinejoin":"round","children":["$undefined",[["$","path","0",{"d":"M4 11a9 9 0 0 1 9 9","children":"$undefined"}],["$","path","1",{"d":"M4 4a16 16 0 0 1 16 16","children":"$undefined"}],["$","circle","2",{"cx":"5","cy":"19","r":"1","children":"$undefined"}]]],"className":"$undefined","style":{"color":"$undefined"},"height":"1em","width":"1em","xmlns":"http://www.w3.org/2000/svg"}]}]]}],["$","div",null,{"className":"hrtgtE fcXWHl cyerGB kKRHCo ","children":["Build with ",["$","$L9",null,{"title":"Hexo official site","rel":"noopener noreferrer external nofollow","href":"https://hexo.io","children":"Hexo"}]," ","and"," ",["$","$L9",null,{"title":"Next.js official site","href":"https://nextjs.org","rel":"noopener noreferrer external nofollow","children":"Next.js"}]]}]]}]]}],["$","$Lb",null,{"children":["$","$Lc",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$Ld",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$","$Lc",null,{"parallelRouterKey":"children","segmentPath":["children","post","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$Ld",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$","$Lc",null,{"parallelRouterKey":"children","segmentPath":["children","post","children",["slug","gulp-uglify-es6-babel","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$Ld",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$Le",null],"segment":"__PAGE__?{\"slug\":\"gulp-uglify-es6-babel\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/275839517c59c532.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/95c7fb627fba8423.css","precedence":"next"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/477df780fc5cb593.css","precedence":"next"}],["$","link","3",{"rel":"stylesheet","href":"/_next/static/css/c40a92e7f996f910.css","precedence":"next"}]]}],"segment":["slug","gulp-uglify-es6-babel","d"]},"styles":[]}],"segment":"post"},"styles":[]}]}],["$","$Lf",null,{"uaId":"UA-103237573-1"}],["$","$L10",null,{}],["$","$L11",null,{}]]}]}]]}] 13:I{"id":"5307","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","92:static/chunks/92-371a458fbe090447.js","284:static/chunks/284-b1d21b691d3eabee.js","605:static/chunks/app/post/[slug]/page-0339b76e369b6af8.js"],"name":"TocTitle","async":false} e:[false,["$","main",null,{"className":"prose eUUCKp kTeytq jmezSN cjScYX eqrBPF jdraHW cRUUAa DOWJl hgvoZN iZwowi jGHqUK kwISoH AsNjI","children":[["$","h1",null,{"className":"EKhXX ","children":"Gulp 用 Babel 降级的方式 uglify ES6 JavaScript"}],"$L12"]}],["$","aside",null,{"className":"cwMEsi dpJmjl gWUoqV kazZiE fsKTUV dkPCxO fcXWHl hrtgtE icKiSN eeREmo fZMRmg hRjOno ","children":["$","div",null,{"className":"doNOqr gepZXl AsideContainer_asideContainer___FNWl","children":["$","div",null,{"className":"bKqOie lkcNSa doNOqr dNtEOi ","children":[["$","div",null,{"className":"hlBtvm ckBWJI XEVlt ","children":"文章目录"}],["$","div",null,{"className":"$undefined","children":["$","ol",null,{"className":"jOeduE ","children":[["$","li",null,{"children":[["$","$L13",null,{"id":"UglifyJS-只支持-ES5","text":"UglifyJS 只支持 ES5"}],false]}],["$","li",null,{"children":[["$","$L13",null,{"id":"async-导致的-Babel-Polyfill-缺失","text":"async 导致的 Babel Polyfill 缺失"}],false]}],["$","li",null,{"children":[["$","$L13",null,{"id":"浏览器-Require-缺失","text":"浏览器 Require 缺失"}],false]}],["$","li",null,{"children":[["$","$L13",null,{"id":"Vinyl-stream-不兼容","text":"Vinyl stream 不兼容"}],false]}],["$","li",null,{"children":[["$","$L13",null,{"id":"总结","text":"总结"}],false]}]]}]}]]}]}]}]] 14:I{"id":"4998","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","92:static/chunks/92-371a458fbe090447.js","284:static/chunks/284-b1d21b691d3eabee.js","605:static/chunks/app/post/[slug]/page-0339b76e369b6af8.js"],"name":"ArticleContentClient","async":false} 18:I{"id":"7974","chunks":["194:static/chunks/194-26e3c21be498c0ce.js","92:static/chunks/92-371a458fbe090447.js","284:static/chunks/284-b1d21b691d3eabee.js","605:static/chunks/app/post/[slug]/page-0339b76e369b6af8.js"],"name":"H1","async":false} 12:["$","$L14",null,{"permalink":"https://www.fengkx.top/post/gulp-uglify-es6-babel/","dateString":"2020-03-16","comments":true,"aplayer":false,"showCopyright":true,"children":[["$","p","2357",{"children":["在写","$L15","主题时用的 Gulp,在 minify JavaScript 的时候遇到了问题。花了挺长时间折腾才找到了解决方法。马后炮的说其实并不难,但是因为 Babel,Gulp 等的版本割裂。网上搜到的方法要么已经过时了或者不全浪费了不少时间。下面用一个","$L16","分步骤地记录一下解决方案。"]}],"\n",["$","blockquote","2360",{"children":["\n",["$","p","2359",{"children":[["$","strong","2358",{"children":["本文写于 2020 年 3 月 16 日"]}]]}],"\n"]}],"\n",["$","pre","2399",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2398",{"className":"language-js","children":[["$","span","2365",{"className":"line","children":[["$","span","2361",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2362",{"style":{"color":"#D73A49"},"children":["async"]}],["$","span","2363",{"style":{"color":"#D73A49"},"children":[" function"]}],["$","span","2364",{"style":{"color":"#24292E"},"children":[" () {"]}]]}],"\n",["$","span","2374",{"className":"line","children":[["$","span","2366",{"style":{"color":"#D73A49"},"children":[" const"]}],["$","span","2367",{"style":{"color":"#005CC5"},"children":[" $main"]}],["$","span","2368",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2369",{"style":{"color":"#24292E"},"children":[" document."]}],["$","span","2370",{"style":{"color":"#6F42C1"},"children":["getElementById"]}],["$","span","2371",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2372",{"style":{"color":"#032F62"},"children":["\"main\""]}],["$","span","2373",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2383",{"className":"line","children":[["$","span","2375",{"style":{"color":"#D73A49"},"children":[" const"]}],["$","span","2376",{"style":{"color":"#005CC5"},"children":[" resp"]}],["$","span","2377",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2378",{"style":{"color":"#D73A49"},"children":[" await"]}],["$","span","2379",{"style":{"color":"#6F42C1"},"children":[" fetch"]}],["$","span","2380",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2381",{"style":{"color":"#032F62"},"children":["\"https://v1.jinrishici.com/all.json\""]}],["$","span","2382",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2391",{"className":"line","children":[["$","span","2384",{"style":{"color":"#D73A49"},"children":[" const"]}],["$","span","2385",{"style":{"color":"#005CC5"},"children":[" data"]}],["$","span","2386",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2387",{"style":{"color":"#D73A49"},"children":[" await"]}],["$","span","2388",{"style":{"color":"#24292E"},"children":[" resp."]}],["$","span","2389",{"style":{"color":"#6F42C1"},"children":["json"]}],["$","span","2390",{"style":{"color":"#24292E"},"children":["();"]}]]}],"\n",["$","span","2395",{"className":"line","children":[["$","span","2392",{"style":{"color":"#24292E"},"children":[" $main.textContent "]}],["$","span","2393",{"style":{"color":"#D73A49"},"children":["="]}],["$","span","2394",{"style":{"color":"#24292E"},"children":[" data.content;"]}]]}],"\n",["$","span","2397",{"className":"line","children":[["$","span","2396",{"style":{"color":"#24292E"},"children":["})();"]}]]}]]}]]}],"\n",["$","p","2401",{"children":["实例的代码很简单。但是用到了 ES2017 的 async 语法。使用的依赖版本可以在","$L17","中看到就不赘述了。"]}],"\n",["$","$L18","2403",{"id":"UglifyJS-只支持-ES5","children":["$L19"]}],"\n",["$","p","2404",{"children":["我们很轻松的就可以写出类似这样的 gulpfile"]}],"\n",["$","pre","2491",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2490",{"className":"language-js","children":[["$","span","2412",{"className":"line","children":[["$","span","2405",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2406",{"style":{"color":"#005CC5"},"children":[" gulp"]}],["$","span","2407",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2408",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2409",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2410",{"style":{"color":"#032F62"},"children":["\"gulp\""]}],["$","span","2411",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2420",{"className":"line","children":[["$","span","2413",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2414",{"style":{"color":"#005CC5"},"children":[" rename"]}],["$","span","2415",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2416",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2417",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2418",{"style":{"color":"#032F62"},"children":["\"gulp-rename\""]}],["$","span","2419",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2428",{"className":"line","children":[["$","span","2421",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2422",{"style":{"color":"#005CC5"},"children":[" uglify"]}],["$","span","2423",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2424",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2425",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2426",{"style":{"color":"#032F62"},"children":["\"gulp-uglify\""]}],["$","span","2427",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2436",{"className":"line","children":[["$","span","2429",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2430",{"style":{"color":"#005CC5"},"children":[" babel"]}],["$","span","2431",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2432",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2433",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2434",{"style":{"color":"#032F62"},"children":["\"gulp-babel\""]}],["$","span","2435",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2437",{"className":"line","children":[]}],"\n",["$","span","2445",{"className":"line","children":[["$","span","2438",{"style":{"color":"#24292E"},"children":["gulp."]}],["$","span","2439",{"style":{"color":"#6F42C1"},"children":["task"]}],["$","span","2440",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2441",{"style":{"color":"#032F62"},"children":["\"js\""]}],["$","span","2442",{"style":{"color":"#24292E"},"children":[", () "]}],["$","span","2443",{"style":{"color":"#D73A49"},"children":["=>"]}],["$","span","2444",{"style":{"color":"#24292E"},"children":[" {"]}]]}],"\n",["$","span","2448",{"className":"line","children":[["$","span","2446",{"style":{"color":"#D73A49"},"children":[" return"]}],["$","span","2447",{"style":{"color":"#24292E"},"children":[" gulp"]}]]}],"\n",["$","span","2454",{"className":"line","children":[["$","span","2449",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2450",{"style":{"color":"#6F42C1"},"children":["src"]}],["$","span","2451",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2452",{"style":{"color":"#032F62"},"children":["\"main.js\""]}],["$","span","2453",{"style":{"color":"#24292E"},"children":[")"]}]]}],"\n",["$","span","2460",{"className":"line","children":[["$","span","2455",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2456",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2457",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2458",{"style":{"color":"#6F42C1"},"children":["uglify"]}],["$","span","2459",{"style":{"color":"#24292E"},"children":["())"]}]]}],"\n",["$","span","2468",{"className":"line","children":[["$","span","2461",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2462",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2463",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2464",{"style":{"color":"#6F42C1"},"children":["rename"]}],["$","span","2465",{"style":{"color":"#24292E"},"children":["({ suffix: "]}],["$","span","2466",{"style":{"color":"#032F62"},"children":["\".min\""]}],["$","span","2467",{"style":{"color":"#24292E"},"children":[" }))"]}]]}],"\n",["$","span","2476",{"className":"line","children":[["$","span","2469",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2470",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2471",{"style":{"color":"#24292E"},"children":["(gulp."]}],["$","span","2472",{"style":{"color":"#6F42C1"},"children":["dest"]}],["$","span","2473",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2474",{"style":{"color":"#032F62"},"children":["\".\""]}],["$","span","2475",{"style":{"color":"#24292E"},"children":["));"]}]]}],"\n",["$","span","2478",{"className":"line","children":[["$","span","2477",{"style":{"color":"#24292E"},"children":["});"]}]]}],"\n",["$","span","2479",{"className":"line","children":[]}],"\n",["$","span","2489",{"className":"line","children":[["$","span","2480",{"style":{"color":"#24292E"},"children":["gulp."]}],["$","span","2481",{"style":{"color":"#6F42C1"},"children":["task"]}],["$","span","2482",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2483",{"style":{"color":"#032F62"},"children":["\"default\""]}],["$","span","2484",{"style":{"color":"#24292E"},"children":[", gulp."]}],["$","span","2485",{"style":{"color":"#6F42C1"},"children":["parallel"]}],["$","span","2486",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2487",{"style":{"color":"#032F62"},"children":["\"js\""]}],["$","span","2488",{"style":{"color":"#24292E"},"children":["));"]}]]}]]}]]}],"\n",["$","p","2492",{"children":["一跑就会发现 UglifyJS 报错。"]}],"\n",["$","pre","2518",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2517",{"className":"language-js","children":[["$","span","2502",{"className":"line","children":[["$","span","2493",{"style":{"color":"#24292E"},"children":["["]}],["$","span","2494",{"style":{"color":"#005CC5"},"children":["13"]}],["$","span","2495",{"style":{"color":"#24292E"},"children":[":"]}],["$","span","2496",{"style":{"color":"#005CC5"},"children":["15"]}],["$","span","2497",{"style":{"color":"#24292E"},"children":[":"]}],["$","span","2498",{"style":{"color":"#005CC5"},"children":["26"]}],["$","span","2499",{"style":{"color":"#24292E"},"children":["] "]}],["$","span","2500",{"style":{"color":"#6F42C1"},"children":["GulpUglifyError"]}],["$","span","2501",{"style":{"color":"#24292E"},"children":[": unable to minify JavaScript"]}]]}],"\n",["$","span","2516",{"className":"line","children":[["$","span","2503",{"style":{"color":"#24292E"},"children":["Caused "]}],["$","span","2504",{"style":{"color":"#6F42C1"},"children":["by"]}],["$","span","2505",{"style":{"color":"#24292E"},"children":[": "]}],["$","span","2506",{"style":{"color":"#6F42C1"},"children":["SyntaxError"]}],["$","span","2507",{"style":{"color":"#24292E"},"children":[": Unexpected "]}],["$","span","2508",{"style":{"color":"#6F42C1"},"children":["token"]}],["$","span","2509",{"style":{"color":"#24292E"},"children":[": keyword «"]}],["$","span","2510",{"style":{"color":"#D73A49"},"children":["function"]}],["$","span","2511",{"style":{"color":"#24292E"},"children":["», "]}],["$","span","2512",{"style":{"color":"#6F42C1"},"children":["expected"]}],["$","span","2513",{"style":{"color":"#24292E"},"children":[": "]}],["$","span","2514",{"style":{"color":"#6F42C1"},"children":["punc"]}],["$","span","2515",{"style":{"color":"#24292E"},"children":[" «)»"]}]]}]]}]]}],"\n",["$","p","2521",{"children":[["$","code","2519",{"children":["gulp-uglify"]}],"使用的","$L1a","只支持 ES5。"]}],"\n",["$","p","2522",{"children":["有两个方法解决"]}],"\n",["$","ol","2527",{"children":["\n",["$","li","2525",{"children":["换用","$L1b","它使用","$L1c","支持 ES6 + 语法压缩。"]}],"\n",["$","li","2526",{"children":["先用 Babel 降级"]}],"\n"]}],"\n",["$","p","2529",{"children":["如果不用考虑兼容性问题,使用第一种方法就不需要往下看了。",["$","s","2528",{"children":["如果我早点知道的话就不会花时间去折腾了"]}]]}],"\n",["$","p","2530",{"children":["我当时很自然的想到用 Babel 降级。"]}],"\n",["$","p","2531",{"children":["引入 Babel 之后的 gulpfile 长这样。"]}],"\n",["$","pre","2633",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2632",{"className":"language-js","children":[["$","span","2539",{"className":"line","children":[["$","span","2532",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2533",{"style":{"color":"#005CC5"},"children":[" gulp"]}],["$","span","2534",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2535",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2536",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2537",{"style":{"color":"#032F62"},"children":["\"gulp\""]}],["$","span","2538",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2547",{"className":"line","children":[["$","span","2540",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2541",{"style":{"color":"#005CC5"},"children":[" rename"]}],["$","span","2542",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2543",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2544",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2545",{"style":{"color":"#032F62"},"children":["\"gulp-rename\""]}],["$","span","2546",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2555",{"className":"line","children":[["$","span","2548",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2549",{"style":{"color":"#005CC5"},"children":[" uglify"]}],["$","span","2550",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2551",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2552",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2553",{"style":{"color":"#032F62"},"children":["\"gulp-uglify\""]}],["$","span","2554",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2563",{"className":"line","children":[["$","span","2556",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2557",{"style":{"color":"#005CC5"},"children":[" babel"]}],["$","span","2558",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2559",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2560",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2561",{"style":{"color":"#032F62"},"children":["\"gulp-babel\""]}],["$","span","2562",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2564",{"className":"line","children":[]}],"\n",["$","span","2572",{"className":"line","children":[["$","span","2565",{"style":{"color":"#24292E"},"children":["gulp."]}],["$","span","2566",{"style":{"color":"#6F42C1"},"children":["task"]}],["$","span","2567",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2568",{"style":{"color":"#032F62"},"children":["\"js\""]}],["$","span","2569",{"style":{"color":"#24292E"},"children":[", () "]}],["$","span","2570",{"style":{"color":"#D73A49"},"children":["=>"]}],["$","span","2571",{"style":{"color":"#24292E"},"children":[" {"]}]]}],"\n",["$","span","2575",{"className":"line","children":[["$","span","2573",{"style":{"color":"#D73A49"},"children":[" return"]}],["$","span","2574",{"style":{"color":"#24292E"},"children":[" gulp"]}]]}],"\n",["$","span","2581",{"className":"line","children":[["$","span","2576",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2577",{"style":{"color":"#6F42C1"},"children":["src"]}],["$","span","2578",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2579",{"style":{"color":"#032F62"},"children":["\"main.js\""]}],["$","span","2580",{"style":{"color":"#24292E"},"children":[")"]}]]}],"\n",["$","span","2585",{"className":"line","children":[["$","span","2582",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2583",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2584",{"style":{"color":"#24292E"},"children":["("]}]]}],"\n",["$","span","2588",{"className":"line","children":[["$","span","2586",{"style":{"color":"#6F42C1"},"children":[" babel"]}],["$","span","2587",{"style":{"color":"#24292E"},"children":["({"]}]]}],"\n",["$","span","2592",{"className":"line","children":[["$","span","2589",{"style":{"color":"#24292E"},"children":[" presets: ["]}],["$","span","2590",{"style":{"color":"#032F62"},"children":["\"@babel/preset-env\""]}],["$","span","2591",{"style":{"color":"#24292E"},"children":["],"]}]]}],"\n",["$","span","2594",{"className":"line","children":[["$","span","2593",{"style":{"color":"#24292E"},"children":[" })"]}]]}],"\n",["$","span","2596",{"className":"line","children":[["$","span","2595",{"style":{"color":"#24292E"},"children":[" )"]}]]}],"\n",["$","span","2602",{"className":"line","children":[["$","span","2597",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2598",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2599",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2600",{"style":{"color":"#6F42C1"},"children":["uglify"]}],["$","span","2601",{"style":{"color":"#24292E"},"children":["())"]}]]}],"\n",["$","span","2610",{"className":"line","children":[["$","span","2603",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2604",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2605",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2606",{"style":{"color":"#6F42C1"},"children":["rename"]}],["$","span","2607",{"style":{"color":"#24292E"},"children":["({ suffix: "]}],["$","span","2608",{"style":{"color":"#032F62"},"children":["\".min\""]}],["$","span","2609",{"style":{"color":"#24292E"},"children":[" }))"]}]]}],"\n",["$","span","2618",{"className":"line","children":[["$","span","2611",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2612",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2613",{"style":{"color":"#24292E"},"children":["(gulp."]}],["$","span","2614",{"style":{"color":"#6F42C1"},"children":["dest"]}],["$","span","2615",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2616",{"style":{"color":"#032F62"},"children":["\".\""]}],["$","span","2617",{"style":{"color":"#24292E"},"children":["));"]}]]}],"\n",["$","span","2620",{"className":"line","children":[["$","span","2619",{"style":{"color":"#24292E"},"children":["});"]}]]}],"\n",["$","span","2621",{"className":"line","children":[]}],"\n",["$","span","2631",{"className":"line","children":[["$","span","2622",{"style":{"color":"#24292E"},"children":["gulp."]}],["$","span","2623",{"style":{"color":"#6F42C1"},"children":["task"]}],["$","span","2624",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2625",{"style":{"color":"#032F62"},"children":["\"default\""]}],["$","span","2626",{"style":{"color":"#24292E"},"children":[", gulp."]}],["$","span","2627",{"style":{"color":"#6F42C1"},"children":["parallel"]}],["$","span","2628",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2629",{"style":{"color":"#032F62"},"children":["\"js\""]}],["$","span","2630",{"style":{"color":"#24292E"},"children":["));"]}]]}]]}]]}],"\n",["$","$L18","2635",{"id":"async-导致的-Babel-Polyfill-缺失","children":["$L1d"]}],"\n",["$","p","2637",{"children":["gulp build 没有报错。但是假如你也和例子中一样使用了",["$","code","2636",{"children":["async"]}],"的话,运行的时候浏览器会报错。"]}],"\n",["$","pre","2642",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2641",{"className":"language-js","children":[["$","span","2640",{"className":"line","children":[["$","span","2638",{"style":{"color":"#6F42C1"},"children":["ReferenceError"]}],["$","span","2639",{"style":{"color":"#24292E"},"children":[": regeneratorRuntime is not defined"]}]]}]]}]]}],"\n",["$","p","2649",{"children":["网上找到的信息多半是安装",["$","code","2643",{"children":["babel-polyfill"]}],", 也有说要安装",["$","code","2644",{"children":["transform-runtime"]}],"等等方法配置 babel。但是",["$","code","2645",{"children":["babel-polyfill"]}],"已经","$L1e","了,为了跟得上时代我们还是得跟官方文档,在","$L1f","就能找了正确的配置方法。我们要引入",["$","code","2648",{"children":["core-js"]}],"。"]}],"\n",["$","p","2650",{"children":["安装好 core-js"]}],"\n",["$","pre","2657",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2656",{"className":"language-shell","children":[["$","span","2655",{"className":"line","children":[["$","span","2651",{"style":{"color":"#6F42C1"},"children":["npm"]}],["$","span","2652",{"style":{"color":"#032F62"},"children":[" install"]}],["$","span","2653",{"style":{"color":"#032F62"},"children":[" core-js@3"]}],["$","span","2654",{"style":{"color":"#005CC5"},"children":[" --save"]}]]}]]}]]}],"\n",["$","p","2658",{"children":["并且更改 gulpfile 中的 babel options"]}],"\n",["$","pre","2677",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2676",{"className":"language-js","children":[["$","span","2660",{"className":"line","children":[["$","span","2659",{"style":{"color":"#24292E"},"children":["{"]}]]}],"\n",["$","span","2663",{"className":"line","children":[["$","span","2661",{"style":{"color":"#6F42C1"},"children":[" presets"]}],["$","span","2662",{"style":{"color":"#24292E"},"children":[": ["]}]]}],"\n",["$","span","2671",{"className":"line","children":[["$","span","2664",{"style":{"color":"#24292E"},"children":[" ["]}],["$","span","2665",{"style":{"color":"#032F62"},"children":["'@babel/preset-env'"]}],["$","span","2666",{"style":{"color":"#24292E"},"children":[", { useBuiltIns: "]}],["$","span","2667",{"style":{"color":"#032F62"},"children":["'usage'"]}],["$","span","2668",{"style":{"color":"#24292E"},"children":[", corejs: "]}],["$","span","2669",{"style":{"color":"#005CC5"},"children":["3"]}],["$","span","2670",{"style":{"color":"#24292E"},"children":[" }]"]}]]}],"\n",["$","span","2673",{"className":"line","children":[["$","span","2672",{"style":{"color":"#24292E"},"children":[" ],"]}]]}],"\n",["$","span","2675",{"className":"line","children":[["$","span","2674",{"style":{"color":"#24292E"},"children":["}"]}]]}]]}]]}],"\n",["$","$L18","2679",{"id":"浏览器-Require-缺失","children":["$L20"]}],"\n",["$","p","2680",{"children":["一通操作下来,浏览器仍然会在运行时报错"]}],"\n",["$","pre","2685",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2684",{"className":"language-js","children":[["$","span","2683",{"className":"line","children":[["$","span","2681",{"style":{"color":"#6F42C1"},"children":["ReferenceError"]}],["$","span","2682",{"style":{"color":"#24292E"},"children":[": require is not defined"]}]]}]]}]]}],"\n",["$","p","2688",{"children":["说到 require 自然会想到","$L21","。于是依照","$L22","我们很自然的写出类似这样的 gulpfile"]}],"\n",["$","pre","2800",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2799",{"className":"language-js","children":[["$","span","2696",{"className":"line","children":[["$","span","2689",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2690",{"style":{"color":"#005CC5"},"children":[" gulp"]}],["$","span","2691",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2692",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2693",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2694",{"style":{"color":"#032F62"},"children":["\"gulp\""]}],["$","span","2695",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2704",{"className":"line","children":[["$","span","2697",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2698",{"style":{"color":"#005CC5"},"children":[" rename"]}],["$","span","2699",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2700",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2701",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2702",{"style":{"color":"#032F62"},"children":["\"gulp-rename\""]}],["$","span","2703",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2712",{"className":"line","children":[["$","span","2705",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2706",{"style":{"color":"#005CC5"},"children":[" uglify"]}],["$","span","2707",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2708",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2709",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2710",{"style":{"color":"#032F62"},"children":["\"gulp-uglify\""]}],["$","span","2711",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2720",{"className":"line","children":[["$","span","2713",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2714",{"style":{"color":"#005CC5"},"children":[" babel"]}],["$","span","2715",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2716",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2717",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2718",{"style":{"color":"#032F62"},"children":["\"gulp-babel\""]}],["$","span","2719",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2728",{"className":"line","children":[["$","span","2721",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2722",{"style":{"color":"#005CC5"},"children":[" browserify"]}],["$","span","2723",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2724",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2725",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2726",{"style":{"color":"#032F62"},"children":["\"browserify\""]}],["$","span","2727",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2729",{"className":"line","children":[]}],"\n",["$","span","2737",{"className":"line","children":[["$","span","2730",{"style":{"color":"#24292E"},"children":["gulp."]}],["$","span","2731",{"style":{"color":"#6F42C1"},"children":["task"]}],["$","span","2732",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2733",{"style":{"color":"#032F62"},"children":["\"js\""]}],["$","span","2734",{"style":{"color":"#24292E"},"children":[", () "]}],["$","span","2735",{"style":{"color":"#D73A49"},"children":["=>"]}],["$","span","2736",{"style":{"color":"#24292E"},"children":[" {"]}]]}],"\n",["$","span","2743",{"className":"line","children":[["$","span","2738",{"style":{"color":"#D73A49"},"children":[" return"]}],["$","span","2739",{"style":{"color":"#6F42C1"},"children":[" browserify"]}],["$","span","2740",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2741",{"style":{"color":"#032F62"},"children":["\"main.js\""]}],["$","span","2742",{"style":{"color":"#24292E"},"children":[")"]}]]}],"\n",["$","span","2749",{"className":"line","children":[["$","span","2744",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2745",{"style":{"color":"#6F42C1"},"children":["transform"]}],["$","span","2746",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2747",{"style":{"color":"#032F62"},"children":["\"babelify\""]}],["$","span","2748",{"style":{"color":"#24292E"},"children":[", {"]}]]}],"\n",["$","span","2757",{"className":"line","children":[["$","span","2750",{"style":{"color":"#24292E"},"children":[" presets: [["]}],["$","span","2751",{"style":{"color":"#032F62"},"children":["\"@babel/preset-env\""]}],["$","span","2752",{"style":{"color":"#24292E"},"children":[", { useBuiltIns: "]}],["$","span","2753",{"style":{"color":"#032F62"},"children":["\"usage\""]}],["$","span","2754",{"style":{"color":"#24292E"},"children":[", corejs: "]}],["$","span","2755",{"style":{"color":"#005CC5"},"children":["3"]}],["$","span","2756",{"style":{"color":"#24292E"},"children":[" }]],"]}]]}],"\n",["$","span","2759",{"className":"line","children":[["$","span","2758",{"style":{"color":"#24292E"},"children":[" })"]}]]}],"\n",["$","span","2763",{"className":"line","children":[["$","span","2760",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2761",{"style":{"color":"#6F42C1"},"children":["bundle"]}],["$","span","2762",{"style":{"color":"#24292E"},"children":["()"]}]]}],"\n",["$","span","2769",{"className":"line","children":[["$","span","2764",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2765",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2766",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2767",{"style":{"color":"#6F42C1"},"children":["uglify"]}],["$","span","2768",{"style":{"color":"#24292E"},"children":["())"]}]]}],"\n",["$","span","2777",{"className":"line","children":[["$","span","2770",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2771",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2772",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2773",{"style":{"color":"#6F42C1"},"children":["rename"]}],["$","span","2774",{"style":{"color":"#24292E"},"children":["({ suffix: "]}],["$","span","2775",{"style":{"color":"#032F62"},"children":["\".min\""]}],["$","span","2776",{"style":{"color":"#24292E"},"children":[" }))"]}]]}],"\n",["$","span","2785",{"className":"line","children":[["$","span","2778",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2779",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2780",{"style":{"color":"#24292E"},"children":["(gulp."]}],["$","span","2781",{"style":{"color":"#6F42C1"},"children":["dest"]}],["$","span","2782",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2783",{"style":{"color":"#032F62"},"children":["\".\""]}],["$","span","2784",{"style":{"color":"#24292E"},"children":["));"]}]]}],"\n",["$","span","2787",{"className":"line","children":[["$","span","2786",{"style":{"color":"#24292E"},"children":["});"]}]]}],"\n",["$","span","2788",{"className":"line","children":[]}],"\n",["$","span","2798",{"className":"line","children":[["$","span","2789",{"style":{"color":"#24292E"},"children":["gulp."]}],["$","span","2790",{"style":{"color":"#6F42C1"},"children":["task"]}],["$","span","2791",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2792",{"style":{"color":"#032F62"},"children":["\"default\""]}],["$","span","2793",{"style":{"color":"#24292E"},"children":[", gulp."]}],["$","span","2794",{"style":{"color":"#6F42C1"},"children":["parallel"]}],["$","span","2795",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2796",{"style":{"color":"#032F62"},"children":["\"js\""]}],["$","span","2797",{"style":{"color":"#24292E"},"children":["));"]}]]}]]}]]}],"\n",["$","p","2801",{"children":["build 一下遇到了这样奇怪的错误,"]}],"\n",["$","pre","2807",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2806",{"className":"language-js","children":[["$","span","2805",{"className":"line","children":[["$","span","2802",{"style":{"color":"#6F42C1"},"children":["TypeError"]}],["$","span","2803",{"style":{"color":"#24292E"},"children":[": file.isNull is not a "]}],["$","span","2804",{"style":{"color":"#D73A49"},"children":["function"]}]]}]]}]]}],"\n",["$","$L18","2809",{"id":"Vinyl-stream-不兼容","children":["$L23"]}],"\n",["$","p","2811",{"children":["问题出在 Browserify 的流和 Gulp 的流不兼容。Gulp 的流使用的是","$L24",", 而 browserify 使用的 node fs 的流。我们需要额外做一些转换。"]}],"\n",["$","p","2812",{"children":["安装相关的包。"]}],"\n",["$","pre","2824",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2823",{"className":"language-shell","children":[["$","span","2817",{"className":"line","children":[["$","span","2813",{"style":{"color":"#6F42C1"},"children":["npm"]}],["$","span","2814",{"style":{"color":"#032F62"},"children":[" i"]}],["$","span","2815",{"style":{"color":"#005CC5"},"children":[" -D"]}],["$","span","2816",{"style":{"color":"#032F62"},"children":[" vinyl-source-stream"]}]]}],"\n",["$","span","2822",{"className":"line","children":[["$","span","2818",{"style":{"color":"#6F42C1"},"children":["npm"]}],["$","span","2819",{"style":{"color":"#032F62"},"children":[" i"]}],["$","span","2820",{"style":{"color":"#005CC5"},"children":[" -D"]}],["$","span","2821",{"style":{"color":"#032F62"},"children":[" vinyl-buffer"]}]]}]]}]]}],"\n",["$","p","2825",{"children":["最终 gulpfile"]}],"\n",["$","pre","2967",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2966",{"className":"language-js","children":[["$","span","2833",{"className":"line","children":[["$","span","2826",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2827",{"style":{"color":"#005CC5"},"children":[" gulp"]}],["$","span","2828",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2829",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2830",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2831",{"style":{"color":"#032F62"},"children":["\"gulp\""]}],["$","span","2832",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2841",{"className":"line","children":[["$","span","2834",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2835",{"style":{"color":"#005CC5"},"children":[" rename"]}],["$","span","2836",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2837",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2838",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2839",{"style":{"color":"#032F62"},"children":["\"gulp-rename\""]}],["$","span","2840",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2849",{"className":"line","children":[["$","span","2842",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2843",{"style":{"color":"#005CC5"},"children":[" uglify"]}],["$","span","2844",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2845",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2846",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2847",{"style":{"color":"#032F62"},"children":["\"gulp-uglify\""]}],["$","span","2848",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2857",{"className":"line","children":[["$","span","2850",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2851",{"style":{"color":"#005CC5"},"children":[" babel"]}],["$","span","2852",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2853",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2854",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2855",{"style":{"color":"#032F62"},"children":["\"gulp-babel\""]}],["$","span","2856",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2865",{"className":"line","children":[["$","span","2858",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2859",{"style":{"color":"#005CC5"},"children":[" browserify"]}],["$","span","2860",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2861",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2862",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2863",{"style":{"color":"#032F62"},"children":["\"browserify\""]}],["$","span","2864",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2873",{"className":"line","children":[["$","span","2866",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2867",{"style":{"color":"#005CC5"},"children":[" source"]}],["$","span","2868",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2869",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2870",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2871",{"style":{"color":"#032F62"},"children":["\"vinyl-source-stream\""]}],["$","span","2872",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2881",{"className":"line","children":[["$","span","2874",{"style":{"color":"#D73A49"},"children":["const"]}],["$","span","2875",{"style":{"color":"#005CC5"},"children":[" buffer"]}],["$","span","2876",{"style":{"color":"#D73A49"},"children":[" ="]}],["$","span","2877",{"style":{"color":"#6F42C1"},"children":[" require"]}],["$","span","2878",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2879",{"style":{"color":"#032F62"},"children":["\"vinyl-buffer\""]}],["$","span","2880",{"style":{"color":"#24292E"},"children":[");"]}]]}],"\n",["$","span","2882",{"className":"line","children":[]}],"\n",["$","span","2890",{"className":"line","children":[["$","span","2883",{"style":{"color":"#24292E"},"children":["gulp."]}],["$","span","2884",{"style":{"color":"#6F42C1"},"children":["task"]}],["$","span","2885",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2886",{"style":{"color":"#032F62"},"children":["\"js\""]}],["$","span","2887",{"style":{"color":"#24292E"},"children":[", () "]}],["$","span","2888",{"style":{"color":"#D73A49"},"children":["=>"]}],["$","span","2889",{"style":{"color":"#24292E"},"children":[" {"]}]]}],"\n",["$","span","2896",{"className":"line","children":[["$","span","2891",{"style":{"color":"#D73A49"},"children":[" return"]}],["$","span","2892",{"style":{"color":"#6F42C1"},"children":[" browserify"]}],["$","span","2893",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2894",{"style":{"color":"#032F62"},"children":["\"main.js\""]}],["$","span","2895",{"style":{"color":"#24292E"},"children":[")"]}]]}],"\n",["$","span","2902",{"className":"line","children":[["$","span","2897",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2898",{"style":{"color":"#6F42C1"},"children":["transform"]}],["$","span","2899",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2900",{"style":{"color":"#032F62"},"children":["\"babelify\""]}],["$","span","2901",{"style":{"color":"#24292E"},"children":[", {"]}]]}],"\n",["$","span","2910",{"className":"line","children":[["$","span","2903",{"style":{"color":"#24292E"},"children":[" presets: [["]}],["$","span","2904",{"style":{"color":"#032F62"},"children":["\"@babel/preset-env\""]}],["$","span","2905",{"style":{"color":"#24292E"},"children":[", { useBuiltIns: "]}],["$","span","2906",{"style":{"color":"#032F62"},"children":["\"usage\""]}],["$","span","2907",{"style":{"color":"#24292E"},"children":[", corejs: "]}],["$","span","2908",{"style":{"color":"#005CC5"},"children":["3"]}],["$","span","2909",{"style":{"color":"#24292E"},"children":[" }]],"]}]]}],"\n",["$","span","2912",{"className":"line","children":[["$","span","2911",{"style":{"color":"#24292E"},"children":[" })"]}]]}],"\n",["$","span","2916",{"className":"line","children":[["$","span","2913",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2914",{"style":{"color":"#6F42C1"},"children":["bundle"]}],["$","span","2915",{"style":{"color":"#24292E"},"children":["()"]}]]}],"\n",["$","span","2924",{"className":"line","children":[["$","span","2917",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2918",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2919",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2920",{"style":{"color":"#6F42C1"},"children":["source"]}],["$","span","2921",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2922",{"style":{"color":"#032F62"},"children":["\"main.js\""]}],["$","span","2923",{"style":{"color":"#24292E"},"children":["))"]}]]}],"\n",["$","span","2930",{"className":"line","children":[["$","span","2925",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2926",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2927",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2928",{"style":{"color":"#6F42C1"},"children":["buffer"]}],["$","span","2929",{"style":{"color":"#24292E"},"children":["())"]}]]}],"\n",["$","span","2936",{"className":"line","children":[["$","span","2931",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2932",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2933",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2934",{"style":{"color":"#6F42C1"},"children":["uglify"]}],["$","span","2935",{"style":{"color":"#24292E"},"children":["())"]}]]}],"\n",["$","span","2944",{"className":"line","children":[["$","span","2937",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2938",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2939",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2940",{"style":{"color":"#6F42C1"},"children":["rename"]}],["$","span","2941",{"style":{"color":"#24292E"},"children":["({ suffix: "]}],["$","span","2942",{"style":{"color":"#032F62"},"children":["\".min\""]}],["$","span","2943",{"style":{"color":"#24292E"},"children":[" }))"]}]]}],"\n",["$","span","2952",{"className":"line","children":[["$","span","2945",{"style":{"color":"#24292E"},"children":[" ."]}],["$","span","2946",{"style":{"color":"#6F42C1"},"children":["pipe"]}],["$","span","2947",{"style":{"color":"#24292E"},"children":["(gulp."]}],["$","span","2948",{"style":{"color":"#6F42C1"},"children":["dest"]}],["$","span","2949",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2950",{"style":{"color":"#032F62"},"children":["\".\""]}],["$","span","2951",{"style":{"color":"#24292E"},"children":["));"]}]]}],"\n",["$","span","2954",{"className":"line","children":[["$","span","2953",{"style":{"color":"#24292E"},"children":["});"]}]]}],"\n",["$","span","2955",{"className":"line","children":[]}],"\n",["$","span","2965",{"className":"line","children":[["$","span","2956",{"style":{"color":"#24292E"},"children":["gulp."]}],["$","span","2957",{"style":{"color":"#6F42C1"},"children":["task"]}],["$","span","2958",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2959",{"style":{"color":"#032F62"},"children":["\"default\""]}],["$","span","2960",{"style":{"color":"#24292E"},"children":[", gulp."]}],["$","span","2961",{"style":{"color":"#6F42C1"},"children":["parallel"]}],["$","span","2962",{"style":{"color":"#24292E"},"children":["("]}],["$","span","2963",{"style":{"color":"#032F62"},"children":["\"js\""]}],["$","span","2964",{"style":{"color":"#24292E"},"children":["));"]}]]}]]}]]}],"\n",["$","$L18","2968",{"id":"总结","children":["总结"]}],"\n",["$","p","2970",{"children":["至此这么一小段 js 终于被编译成可以运行的 minify 的 ES5 了。可是这么一通操作下来引入了 core-js 做 polyfill 体积不减反增",["$","s","2969",{"children":["maxify"]}],"。"]}],"\n",["$","pre","2976",{"className":"shiki github-light","style":{"backgroundColor":"#fff","color":"#24292e"},"tabindex":"0","children":[["$","code","2975",{"className":"language-text","children":[["$","span","2972",{"className":"line","children":[["$","span","2971",{"children":["4.0K main.js"]}]]}],"\n",["$","span","2974",{"className":"line","children":[["$","span","2973",{"children":["36K main.min.js"]}]]}]]}]]}],"\n",["$","p","2978",{"children":["所以说如果不考虑兼容性就直接用",["$","code","2977",{"children":["gulp-uglify-es"]}],"好了。"]}],"\n",["$","p","2979",{"children":["前端的构建工具大版本总是不兼容,网上的信息也很多已经过时了。这篇文章估计在不久之后也会过时的。不得不说跟上时代最好的方法还是官方文档呀。"]}],"\n",["$","p","2984",{"children":["$L25",",各个步骤都对应的分支。",["$","br","2981",{}],"\n我们还可以借助",["$","code","2982",{"children":["github-history"]}],"来看 ","$L26","。"]}],"\n"]}] 15:["$","a",null,{"href":"https://github.com/fengkx/hexo-theme-purer","children":["Purer"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 16:["$","a",null,{"href":"https://github.com/fengkx/gulp-uglify-babel-demo","children":["实例"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 17:["$","a",null,{"href":"https://github.com/fengkx/gulp-uglify-babel-demo/blob/master/package.json","children":["package.json"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 19:["$","a",null,{"href":"https://github.com/fengkx/gulp-uglify-babel-demo/tree/fail-uglify-es6","children":["UglifyJS 只支持 ES5"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 1a:["$","a",null,{"href":"https://github.com/mishoo/UglifyJS2","children":["UglifyJS"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 1b:["$","a",null,{"href":"https://www.npmjs.com/package/gulp-uglify-es","children":["gulp-uglify-es"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 1c:["$","a",null,{"href":"https://terser.org/","children":["terser"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 1d:["$","a",null,{"href":"https://github.com/fengkx/gulp-uglify-babel-demo/tree/fail-async-polyfill","children":["async 导致的 Babel Polyfill 缺失"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 1e:["$","a",null,{"href":"https://babeljs.io/docs/en/babel-polyfill","children":["Deprecated"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 1f:["$","a",null,{"href":"https://babeljs.io/docs/en/babel-preset-env#usebuiltins","children":["babel-preset-env 的官方文档"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 20:["$","a",null,{"href":"https://github.com/fengkx/gulp-uglify-babel-demo/tree/fail-require-not-defined","children":["浏览器 Require 缺失"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 21:["$","a",null,{"href":"http://browserify.org/","children":["Browserify"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 22:["$","a",null,{"href":"https://github.com/babel/babelify","children":["文档借助 Babelify "],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 23:["$","a",null,{"href":"https://github.com/fengkx/gulp-uglify-babel-demo/tree/fail-gulp-use-vinyl","children":["Vinyl stream 不兼容"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 24:["$","a",null,{"href":"https://gulpjs.com/docs/en/api/vinyl","children":["Vinyl"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 25:["$","a",null,{"href":"https://github.com/fengkx/gulp-uglify-babel-demo","children":["实例放在了 GitHub"],"target":"_blank","rel":"noopener noreferrer external nofollow"}] 26:["$","a",null,{"href":"https://github-history.netlify.com/fengkx/gulp-uglify-babel-demo/blob/master/gulpfile.js","children":["gulpfile 的变化"],"target":"_blank","rel":"noopener noreferrer external nofollow"}]