{"id":87609,"date":"2020-05-11T14:43:53","date_gmt":"2020-05-11T06:43:53","guid":{"rendered":"http:\/\/4563.org\/?p=87609"},"modified":"2020-05-11T14:43:53","modified_gmt":"2020-05-11T06:43:53","slug":"babel-%e6%95%99%e7%a8%8b%ef%bc%8c%e8%87%aa%e5%b7%b1%e5%86%99%e7%9a%84%e7%ac%ac%e4%b8%80%e4%bb%bd%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=87609","title":{"rendered":"Babel \u6559\u7a0b\uff0c\u81ea\u5df1\u5199\u7684\u7b2c\u4e00\u4efd\u6559\u7a0b"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Babel \u6559\u7a0b\uff0c\u81ea\u5df1\u5199\u7684\u7b2c\u4e00\u4efd\u6559\u7a0b               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jruit <\/span>  <span><i><\/i> 9<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u81ea\u5df1\u5199\u4e86\u4e00\u4efd\u6559\u7a0b Babel \u6559\u7a0b<\/p>\n<p>\u5728\u6700\u521d\u505a\u524d\u7aef\u5f00\u53d1\u7684\u65f6\u5019\uff0c\u81ea\u5df1\u88ab Babel \u90a3\u4e00\u5806 babel-preset-es2015 \u3001babel-preset-es2016 \u3001babel-preset-stage-0 \u3001babel-preset-stage-1 \u3001 @babel\/preset-env \u548c @babel\/plugin-transform-runtime \u641e\u7cca\u6d82\u4e86\u3002\u5230\u5e95\u8be5\u7528\u54ea\u4e9b\uff0c\u5230\u5e95\u600e\u4e48\u914d\u7f6e\u624d\u662f\u5bf9\u7684\u3002<\/p>\n<p>\u7136\u540e\u5728\u8fd9\u79cd\u6df7\u4e71\u72b6\u6001\u4e0b\u505a\u5b8c\u7b2c\u4e00\u5e74\u5f00\u53d1\u7684\u65f6\u5019\uff0c\u624d\u6e10\u6e10\u5bf9 Babel \u6709\u4e86\u8ba4\u77e5\u3002\u4f46\u662f\u8ba4\u77e5\u4e5f\u662f\u4e0d\u5168\u7684\uff0c\u4ece Babel6 \u5230 Babel7\uff0c\u5927\u91cf\u5b66\u5230\u7684\u4e1c\u897f\u5176\u5b9e\u662f\u6dd8\u6c70\u6216\u9519\u8bef\u7684\u3002\u96f6\u6563\u7684\uff0c\u9519\u8bef\u7684\u77e5\u8bc6\u788e\u7247\uff0c\u7ed9\u4e86\u6211\u4eec\u8fd9\u4e9b\u521d\u5b66\u8005\u5f88\u5927\u7684\u5b66\u4e60\u96be\u5ea6\u3002<\/p>\n<p>\u73b0\u5728\u662f\u505a\u524d\u7aef\u5f00\u53d1\u7684\u7b2c\u4e94\u5e74\u4e86\uff0c\u4ecd\u7136\u53ef\u4ee5\u770b\u5230\u5927\u91cf\u9519\u8bef\u7684\u6587\u7ae0\u5728\u6280\u672f\u793e\u533a\u51fa\u73b0\uff0c\u5728\u6559\u4f60\u7528 babel-preset-stage-1 \u8fd9\u4e9b\u5df2\u7ecf\u65e9\u5df2\u6dd8\u6c70\u7684\u4e1c\u897f\u3002\u4e8e\u662f\u4fbf\u5199\u4e86\u8fd9\u4efd\u6559\u7a0b\uff0c\u5e0c\u671b\u80fd\u5bf9 JavaScript \u5f00\u53d1\u8005\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<p>\u6559\u7a0b\u4e3b\u4f53\u5df2\u57fa\u672c\u5b8c\u6210\uff0c@babel\/preset-env \u9884\u8bbe\u548c @babel\/plugin-transform-runtime \u63d2\u4ef6\u6d89\u53ca\u5230\u7684\u77e5\u8bc6\u592a\u591a\uff0c\u8017\u8d39\u4e86\u4e0d\u5c11\u7cbe\u529b\u548c\u65f6\u95f4\u3002\u4e3a\u4e86\u66f4\u597d\u7684\u628a\u8fd9\u4e24\u4e2a\u4e1c\u897f\u8bb2\u900f\u5f7b\uff0c\u4e4b\u540e\u4f1a\u8fdb\u884c\u4e00\u4e9b\u8865\u5145\u548c\u6539\u8fdb\u3002\u5927\u5bb6\u6709\u9875\u9762 UI \u5efa\u8bae\u6216\u4ee3\u7801\u8fd0\u884c\u7b49\u9519\u8bef\u7684\u95ee\u9898\u90fd\u53ef\u4ee5\u63d0\u51fa\u6765\uff0c\u6211\u52aa\u529b\u6539\u8fdb\u3002<\/p>\n<p>\u6559\u7a0b\u5730\u5740 Babel \u6559\u7a0b &#8211; \u59dc\u745e\u6d9b\u7684\u5b98\u65b9\u7f51\u7ad9\uff0c\u914d\u5957\u7684\u4ee3\u7801\u5728 github https:\/\/github.com\/jruit\/babel-tutorial<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>15<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1457750\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wszgrcy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             js \u914d\u7f6e\u8fd9\u73a9\u610f\u592a\u4e71\uff0c\u5982\u679c\u53ef\u4ee5\u5efa\u8bae ts+core-js&#8230;&#8230;\u6211\u611f\u89c9\u4e3a\u4e86 js \u652f\u6301\u67d0\u79cd\u7279\u6027\u518d\u914d\u7f6e bable\uff0c\u6709\u79cd\u624b\u5de5\u6d3b\u7684\u611f\u89c9\u3002\u3002\u3002\u3002\u4e0d\u8fc7\u8fd8\u662f\u652f\u6301\u4e3b\u5206\u4eab                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457751\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : troycode <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7ed1\u5b9a \u597d\u5e16                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457752\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : bojue <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ea\u662f\u914d\u7f6e\u7684\u8bdd\u5bf9\u521d\u5b66\u8005\u6709\u7528\uff0c\u6709\u7ecf\u9a8c\u7684\u611f\u89c9\u610f\u4e49\u4e0d\u5927\uff0c\u53ef\u4ee5\u4ece\u539f\u7406\u5c42\u8bb2\u89e3\u7684\u66f4\u6df1\u5165\u4e00\u4e9b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457753\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : m0cha <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u597d\u8d34\u6536\u85cf                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457754\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : teawithlife <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5199\u7684\u5f88\u597d\uff0c\u5bf9\u6211\u8fd9\u79cd\u521d\u5b66\u8005\u5f88\u6709\u5e2e\u52a9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457755\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xrr2016 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8d5e\u4e00\u4e2a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457756\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ixoy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ee5\u6df1\u5165\u4e86\u89e3\u5c31\u5230\u4e86\u62bd\u8c61\u8bed\u6cd5\u6811\uff08 AST \uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457757\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tienyc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148\u8d5e\u518d\u770b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457758\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jruit <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @wszgrcy js \u751f\u6001\u786e\u5b9e\u6709\u4e9b\u4e71\uff0c\u53ea\u8981\u6d4f\u89c8\u5668\u5382\u5546\u6807\u51c6\u6709\u53d8\u5316\uff0c\u524d\u7aef\u5f00\u53d1\u5c31\u8981\u4f1a\u4e00\u76f4\u9762\u5bf9\u8fd9\u4e2a\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457759\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jruit <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @bojue <br \/>@ixoy \u611f\u8c22\u610f\u4e49\uff0c\u540e\u9762\u4f1a\u8003\u8651\u589e\u52a0\u5173\u4e8e\u539f\u7406\u65b9\u9762\u7684\u5185\u5bb9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457760\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dinjufen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e5f\u611f\u89c9\uff0c\u641c\u5230\u7684\u4e1c\u897f\u592a\u4e71\u4e86\uff0c\u800c\u4e14\u524d\u7aef\u53d8\u5316\u5feb\uff0c\u4e24\u5e74\u524d\u5199\u7684\u4e1c\u897f\u4e0d\u4e00\u5b9a\u6562\u7167\u7528\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457761\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : angel001ma <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6559\u7a0b\u5199\u7684\u4e0d\u9519\uff0c\u8fd9\u91cc\u6211\u63d0\u4e0b\u8fd9\u4e9b\u5e93\u76ee\u524d\u7684\u72b6\u51b5<br \/>\u5bf9\u4e8e babel-preset-es2015 \u3001babel-preset-es2016 \u3001babel-preset-stage-0 \u3001babel-preset-stage-1\uff0c\u76ee\u524d\u53ef\u4ee5\u4f7f\u7528 @babel\/preset-env \u4ee3\u66ff<\/p>\n<p>\u5bf9\u4e8e @babel\/plugin-transform-runtime \u548c @babel\/polyfill \u7684\u533a\u522b\uff0c\u53ef\u4ee5\u770b https:\/\/segmentfault.com\/q\/1010000005596587?from=singlemessage&amp;isappinstalled=1<\/p>\n<p>babel-plugin-transform-runtime \u3001babel-polyfill&#8230;\u8fd9\u4e9b babel \u524d\u7f00\u7684\u662f babel6 \u53ca\u4e4b\u524d\u7248\u672c\u4f7f\u7528\u7684\uff0cbabel7 \u90fd\u4f7f\u7528 @babel \u524d\u7f00\u7684 @babel\/xxx                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457762\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : angel001ma <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b9e\u9645\u9879\u76ee\u53ef\u4ee5\u4f7f\u7528 @babel\/polyfill \u505a\u524d\u7f6e\u7684\u5f15\u5165\uff0c\u57fa\u672c\u4e0d\u4f1a\u6709\u8bed\u6cd5\u517c\u5bb9\u95ee\u9898<br \/>\u505a\u63d2\u4ef6\u6216\u8005\u5e93\uff0c\u63a8\u8350\u53ea\u4f7f\u7528 @babel\/preset-env \u548c @babel\/plugin-transform-runtime \u505a\u8bed\u6cd5\u7cd6\u7684\u8f6c\u6362\uff0c\u4ee3\u7801\u4e2d\u4e5f\u522b\u6d89\u53ca\u65b0\u7684 API \u3002\u4f8b\u5982\uff0cIterator \u3001Generator \u3001Set \u3001Maps \u3001Proxy \u3001Reflect \u3001Symbol \u3001Promise \u7b49\u5168\u5c40\u5bf9\u8c61\uff0c\u4ee5\u53ca\u4e00\u4e9b\u5b9a\u4e49\u5728\u5168\u5c40\u5bf9\u8c61\u4e0a\u7684\u5b9e\u4f8b\u65b9\u6cd5\uff08\u4f8b\u5982\u9759\u6001\u65b9\u6cd5 Array.isArray \u53ef\u652f\u6301\uff0c\u5b9e\u4f8b\u65b9\u6cd5 array.includes \u4e0d\u652f\u6301\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457763\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jruit <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @angel001ma \u611f\u8c22\u5206\u4eab                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1457764\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : FourAndHalf <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u611f\u8c22\u5206\u4eab                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Babel \u6559\u7a0b\uff0c\u81ea\u5df1\u5199\u7684\u7b2c\u4e00\u4efd\u6559&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/87609"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=87609"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/87609\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=87609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=87609"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=87609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}