{"id":93706,"date":"2020-04-13T13:25:25","date_gmt":"2020-04-13T05:25:25","guid":{"rendered":"http:\/\/4563.org\/?p=93706"},"modified":"2020-04-13T13:25:25","modified_gmt":"2020-04-13T05:25:25","slug":"%e6%9c%89%e6%b2%a1%e6%9c%89%e6%af%94%e8%be%83%e8%bd%bb%e9%87%8f%e7%ba%a7%e7%9a%84%e5%88%9d%e5%a7%8b%e5%8c%96%e6%88%96%e8%80%85%e9%85%8d%e7%bd%ae-react-js-%e7%8e%af%e5%a2%83%e7%9a%84%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=93706","title":{"rendered":"\u6709\u6ca1\u6709\u6bd4\u8f83\u8f7b\u91cf\u7ea7\u7684\u521d\u59cb\u5316\u6216\u8005\u914d\u7f6e react.js \u73af\u5883\u7684\u5de5\u5177\/\u811a\u672c\u6216\u8005 blog\/\u6587\u7ae0\u4e5f\u884c\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6709\u6ca1\u6709\u6bd4\u8f83\u8f7b\u91cf\u7ea7\u7684\u521d\u59cb\u5316\u6216\u8005\u914d\u7f6e react.js \u73af\u5883\u7684\u5de5\u5177\/\u811a\u672c\u6216\u8005 blog\/\u6587\u7ae0\u4e5f\u884c\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yazoox <\/span>  <span><i><\/i> 19<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u521a\u5f00\u59cb\u5b66\uff0c\u7528 create-react-app \u8fd8\u884c\uff0c\u633a\u597d\u7528\u7684\u3002 \u4f46\u662f\u7528\u5b8c\u540e\u53d1\u73b0\uff0creact \u5305\u88c5\u4e86\u4e00\u5806\u811a\u672c\uff0c<\/p>\n<p>\u4ec0\u4e48 eslint, jest, babel, webpack\/parcel\uff0ctsconfig \u914d\u7f6e\u90fd\u6ca1\u6709\u3002<\/p>\n<p>\u4f46\u662f\u901a\u5e38 react.js \u7684 app\uff0c\u90fd\u662f\u9700\u8981\u4e0a\u9762\u8fd9\u6837\u4e00\u6574\u5957\u7684\u914d\u5957\u5de5\u5177\u6216\u8005\u811a\u672c\u7684\u3002\u53d1\u73b0 create-react-app \u597d\u50cf\u90fd\u6ca1\u6709\u76f8\u5173\u7684\u914d\u7f6e\u3002<\/p>\n<p>\u6bd4\u5982\uff1a \u6211\u7528 create-react-app \u7684\u73af\u5883\u4e0b\u8fd0\u884c jest, \u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u5e76\u6210\u529f\u3002<\/p>\n<pre><code>npm test <\/code><\/pre>\n<p>\u4f46\u6211\u81ea\u5df1\u5b89\u88c5\u4e86\u4e00\u4e2a jest, <code>npm install -g jest<\/code> \u7136\u540e <code>jest<\/code> \u5c31\u5168 fail \u4e86&#8230;&#8230;<\/p>\n<p>\u8bf7\u6559\u4e00\u4e0b\u5927\u5bb6\uff0c\u600e\u4e48\u521d\u59cb\u5316\u6216\u8005\u914d\u7f6e\u8fd9\u4e9b\u76f8\u5173\u5de5\u5177\u7684\uff1f\u6709\u76f8\u5173\u5de5\u5177\u6216\u8005\u811a\u672c\uff0c\u6216\u8005\u5927\u5bb6\u770b\u8fc7\u7684\uff0c\u5199\u5f97\u6bd4\u8f83\u597d\u7684 blog \u6587\u7ae0\u5747\u53ef\u3002<\/p>\n<p>p.s. \u767e\u5ea6\u641c\u7d22\u51fa\u6765\u592a\u591a\u91cd\u590d\u4e86\uff0c\u770b\u4e86\u4e00\u4e24\u9875\uff0c\u5565\u90fd\u6ca1\u641e\u660e\u767d\u3002\u82f1\u6587\u7684\u4e5f\u884c\u554a\u3002<\/p>\n<p>\u8c22\u8c22\uff01<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1164187\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : marcong95 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             CRA \u5df2\u7ecf\u5e2e\u4f60\u914d\u597d\u4e86\u4f60\u8bf4\u7684\u4e1c\u897f\u4e86\u5427\uff0c\u53ea\u662f\u914d\u7f6e\u85cf\u8d77\u6765\u4e86\uff0c\u4f60\u771f\u7684\u60f3\u770b\u7684\u8bdd\u53ef\u4ee5 eject \u4e00\u4e0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1164188\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yazoox <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @marcong95 \u4e0d\u597d\u610f\u601d\uff0c\u5144\u5f1f\uff0ceject \u662f\u4ec0\u4e48\u610f\u601d\uff1f\u6216\u8005\u5728\u54ea\u4e2a\u76ee\u5f55\u4e0b\uff1f<br \/>\u6211\u521a\u624d\u81ea\u5df1\u6dfb\u52a0\u4e86 jest.config.js \uff0c\u60f3\u7edf\u8ba1 collect coverage \u53d1\u73b0\u4e0d\u8d77\u4f5c\u7528\u3002\u6309\u4f60\u8bf4\u7684\uff0c\u5b83\u7684\u914d\u7f6e\u653e\u5728\u5176\u5b83\u5730\u65b9\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1164189\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yazoox <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @marcong95 npm run eject<br \/>\u597d\u50cf\u662f\u8fd9\u4e2a&#8230;..                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1164190\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : marcong95 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yazoox #3 \u5fd8\u4e86\u662f npm run eject \u8fd8\u662f npx create-react-app eject \u4e86\uff0c\u6587\u6863\u597d\u50cf\u4e5f\u6ca1\u5199\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1164191\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 1156909789 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             docs https:\/\/create-react-app.dev\/docs\/available-scripts                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u6ca1\u6709\u6bd4\u8f83\u8f7b\u91cf\u7ea7\u7684\u521d\u59cb\u5316\u6216\u8005\u914d\u7f6e &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\/93706"}],"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=93706"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/93706\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93706"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}