{"id":172801,"date":"2020-10-26T04:08:17","date_gmt":"2020-10-25T20:08:17","guid":{"rendered":"http:\/\/4563.org\/?p=172801"},"modified":"2020-10-27T10:15:19","modified_gmt":"2020-10-27T02:15:19","slug":"%e5%9f%ba%e4%ba%8e-react%e3%80%81mobx%e3%80%81webpack-%e5%92%8c-react-router-%e7%9a%84%e9%a1%b9%e7%9b%ae%e6%a8%a1%e6%9d%bf%e3%80%82","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=172801","title":{"rendered":"\u57fa\u4e8e React\u3001Mobx\u3001Webpack \u548c React-Router \u7684\u9879\u76ee\u6a21\u677f\u3002"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u57fa\u4e8e React\u3001Mobx\u3001Webpack \u548c React-Router \u7684\u9879\u76ee\u6a21\u677f\u3002               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LiuJiang <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h2>\u524d\u8a00<\/h2>\n<p>\u81ea\u5df1\u5229\u7528\u4e1a\u4f59\u65f6\u95f4\uff0c\u57fa\u4e8e React \u3001Ant \u3001Webpack \u3001Mobx \u3001React-Router \u3001TS \u5199\u4e86\u4e00\u4e2a\u540e\u53f0\u7ba1\u7406\u6a21\u677f\uff0c\u76ee\u524d\u5df2\u5728\u516c\u53f8\u5185\u90e8\u642d\u5efa\u4e86\u51e0\u5957\u9879\u76ee\uff0c\u5e76\u90fd\u5df2\u4e0a\u7ebf\uff0c\u5e0c\u671b\u5e2e\u52a9\u81ea\u5df1\u68b3\u7406\u5404\u6280\u672f\u6700\u65b0\u77e5\u8bc6\u70b9\uff0c\u540c\u65f6\u4e5f\u5e0c\u671b\u5bf9\u770b\u5230\u7684\u4eba\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<h2>\u9879\u76ee\u6548\u679c\uff1a<\/h2>\n<p>\u767b\u5f55\u9875\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/10\/e2ac91b3eb4d4b81a61d19282215459dtplv-k3u1fbpfcp-zoom-1.image_.png\" alt=\"\u57fa\u4e8e React\u3001Mobx\u3001Webpack \u548c React-Router \u7684\u9879\u76ee\u6a21\u677f\u3002\" \/><\/p>\n<p>404 \u9875\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/10\/11a03231854b445faa0c42143e3f1ec3tplv-k3u1fbpfcp-zoom-1.image_.png\" alt=\"\u57fa\u4e8e React\u3001Mobx\u3001Webpack \u548c React-Router \u7684\u9879\u76ee\u6a21\u677f\u3002\" \/><\/p>\n<p>\u5217\u8868\u9875\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/10\/a38ed09f961140929953f7ac954b4eabtplv-k3u1fbpfcp-zoom-1.image_.png\" alt=\"\u57fa\u4e8e React\u3001Mobx\u3001Webpack \u548c React-Router \u7684\u9879\u76ee\u6a21\u677f\u3002\" \/><\/p>\n<h2>\u5206\u652f<\/h2>\n<p>main hooks + ts<\/p>\n<p>class class + ts<\/p>\n<p>js class + js<\/p>\n<h2>\u5982\u4f55\u5feb\u4e0a\u624b<\/h2>\n<p>\u4e00\u4e2a\u57fa\u672c\u5217\u8868\u5c55\u793a<\/p>\n<h2>\u6e90\u7801\u5730\u5740<\/h2>\n<p>Tristana<\/p>\n<h2>\u5728\u7ebf\u9884\u89c8\u5730\u5740<\/h2>\n<p>Demo<\/p>\n<h2>\u6280\u672f\u6808<\/h2>\n<ul>\n<li>React<\/li>\n<li>Ant<\/li>\n<li>React-Router<\/li>\n<li>Mobx<\/li>\n<li>Webpack<\/li>\n<li>ES6<\/li>\n<li>Babel<\/li>\n<li>Axios<\/li>\n<li>Eslint<\/li>\n<li>Stylelint<\/li>\n<li>TS<\/li>\n<\/ul>\n<h2>\u9879\u76ee\u7ed3\u6784<\/h2>\n<pre><code>. \u251c\u2500\u2500 LICENSE \u251c\u2500\u2500 README.md \u251c\u2500\u2500 README2.md \u251c\u2500\u2500 declaration.d.ts \u251c\u2500\u2500 package.json \u251c\u2500\u2500 prettier.config.js \u251c\u2500\u2500 public \u2502\u00a0\u00a0 \u2514\u2500\u2500 index.html \u251c\u2500\u2500 script \u2502\u00a0\u00a0 \u251c\u2500\u2500 webpack.base.conf.js \u2502\u00a0\u00a0 \u251c\u2500\u2500 webpack.dev.js \u2502\u00a0\u00a0 \u2514\u2500\u2500 webpack.prod.js \u251c\u2500\u2500 src \u2502\u00a0\u00a0 \u251c\u2500\u2500 app.tsx \u2502\u00a0\u00a0 \u251c\u2500\u2500 assets \u2502\u00a0\u00a0 \u251c\u2500\u2500 components \u2502\u00a0\u00a0 \u251c\u2500\u2500 config.ts \u2502\u00a0\u00a0 \u251c\u2500\u2500 index.tsx \u2502\u00a0\u00a0 \u251c\u2500\u2500 locales \u2502\u00a0\u00a0 \u251c\u2500\u2500 mobx \u2502\u00a0\u00a0 \u251c\u2500\u2500 mock \u2502\u00a0\u00a0 \u251c\u2500\u2500 pages \u2502\u00a0\u00a0 \u251c\u2500\u2500 request.tsx \u2502\u00a0\u00a0 \u251c\u2500\u2500 routeConfig.tsx \u2502\u00a0\u00a0 \u251c\u2500\u2500 servers \u2502\u00a0\u00a0 \u251c\u2500\u2500 styles \u2502\u00a0\u00a0 \u251c\u2500\u2500 typings \u2502\u00a0\u00a0 \u2514\u2500\u2500 utils \u251c\u2500\u2500 stylelint.config.js \u2514\u2500\u2500 tsconfig.json <\/code><\/pre>\n<h2>\u5404\u5927\u5e93\u7248\u672c<\/h2>\n<pre><code>\"dependencies\": {         \"@ant-design\/icons\": \"^4.2.2\",         \"@babel\/cli\": \"^7.8.0\",         \"@babel\/core\": \"^7.8.0\",         \"@babel\/plugin-proposal-class-properties\": \"^7.8.0\",         \"@babel\/plugin-proposal-decorators\": \"^7.8.0\",         \"@babel\/plugin-proposal-json-strings\": \"^7.8.0\",         \"@babel\/plugin-proposal-optional-chaining\": \"^7.10.1\",         \"@babel\/plugin-syntax-dynamic-import\": \"^7.8.0\",         \"@babel\/plugin-syntax-import-meta\": \"^7.8.0\",         \"@babel\/plugin-transform-runtime\": \"^7.8.0\",         \"@babel\/polyfill\": \"^7.8.0\",         \"@babel\/preset-env\": \"^7.8.2\",         \"@babel\/preset-react\": \"^7.8.0\",         \"@babel\/preset-stage-2\": \"^7.8.0\",         \"@pmmmwh\/react-refresh-webpack-plugin\": \"^0.3.3\",         \"@sentry\/react\": \"^5.18.1\",         \"@types\/react\": \"^16.9.48\",         \"@types\/react-dom\": \"^16.9.8\",         \"@typescript-eslint\/eslint-plugin\": \"^3.10.1\",         \"@typescript-eslint\/parser\": \"^3.10.1\",         \"antd\": \"^4.5.3\",         \"antd-dayjs-webpack-plugin\": \"^1.0.0\",         \"awesome-typescript-loader\": \"^5.2.1\",         \"axios\": \"^0.19.2\",         \"babel-eslint\": \"^10.0.3\",         \"babel-loader\": \"^8.0.0\",         \"babel-plugin-import\": \"^1.13.0\",         \"babel-plugin-react-css-modules\": \"^5.2.6\",         \"classnames\": \"^2.2.6\",         \"clean-webpack-plugin\": \"^3.0.0\",         \"compression-webpack-plugin\": \"^3.0.1\",         \"copy-webpack-plugin\": \"^5.1.1\",         \"core-js\": \"^3.6.4\",         \"cross-env\": \"^6.0.3\",         \"css-loader\": \"^3.2.0\",         \"dayjs\": \"^1.8.15\",         \"eslint\": \"^6.8.0\",         \"eslint-config-prettier\": \"^6.11.0\",         \"eslint-config-standard\": \"^14.1.0\",         \"eslint-loader\": \"^3.0.4\",         \"eslint-plugin-import\": \"^2.22.0\",         \"eslint-plugin-promise\": \"^4.2.1\",         \"eslint-plugin-react\": \"^7.20.6\",         \"eslint-plugin-standard\": \"^4.0.1\",         \"file-loader\": \"^5.0.2\",         \"history\": \"^4.7.2\",         \"html-webpack-plugin\": \"^3.2.0\",         \"install\": \"^0.12.2\",         \"is-promise\": \"^2.1.0\",         \"less\": \"^3.8.1\",         \"less-loader\": \"^5.0.0\",         \"lint-staged\": \"^10.0.8\",         \"mini-css-extract-plugin\": \"^0.8.0\",         \"mobx\": \"^5.15.6\",         \"mobx-react\": \"^6.1.4\",         \"mobx-react-router\": \"^4.1.0\",         \"mockjs\": \"^1.1.0\",         \"npm\": \"^6.10.2\",         \"optimize-css-assets-webpack-plugin\": \"^5.0.1\",         \"postcss-loader\": \"^3.0.0\",         \"pre-commit\": \"^1.2.2\",         \"progress-bar-webpack-plugin\": \"^1.12.1\",         \"prop-types\": \"^15.7.2\",         \"react\": \"^16.12.0\",         \"react-dom\": \"^16.12.0\",         \"react-intl-universal\": \"^2.2.5\",         \"react-refresh\": \"^0.8.3\",         \"react-router\": \"^5.1.2\",         \"react-router-dom\": \"^5.1.2\",         \"react-scripts\": \"^3.0.0\",         \"socket.io-client\": \"^2.3.0\",         \"source-map-loader\": \"^1.0.2\",         \"speed-measure-webpack-plugin\": \"^1.3.1\",         \"style-loader\": \"^1.2.1\",         \"stylelint\": \"^13.0.0\",         \"stylelint-config-prettier\": \"^8.0.2\",         \"stylelint-config-standard\": \"^19.0.0\",         \"terser-webpack-plugin\": \"^2.2.1\",         \"trtc-js-sdk\": \"^4.6.3\",         \"ts-import-plugin\": \"^1.6.6\",         \"typescript\": \"^4.0.2\",         \"webpack\": \"^4.41.2\",         \"webpack-bundle-analyzer\": \"^3.6.0\",         \"webpack-cli\": \"^3.3.10\",         \"webpack-dev-server\": \"^3.10.1\"     }, <\/code><\/pre>\n<h2>\u6700\u540e<\/h2>\n<p>\u5982\u679c\u4f60\u89c9\u5f97\u8fd8\u4e0d\u9519\u6216\u8005\u6709\u5e2e\u52a9\u7684\u540c\u5b66\uff0c\u6b22\u8fce\u5173\u6ce8\uff0c\u591a\u591a star \uff1b\u6b22\u8fce\u5173\u6ce8\u6211\u7684Blog<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3807542\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fewok <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u4e48\uff0c\u5148 star \u5427\u3002\u7c7b\u4f3c\u7684\u5f88\u591a\uff0c\u6bd4\u5982 https:\/\/umijs.org \u3001https:\/\/github.com\/ykfe\/egg-react-ssr<br \/>\u6240\u4ee5\uff0c\u5bf9\u4e8e react \u811a\u624b\u67b6\u662f\u8d8a\u6765\u8d8a\u590d\u6742\u4e86\uff0cReact \u3001Mobx \u3001React-Router \u662f\u57fa\u672c\uff0c\u7136\u540e\u80fd\u4e0d\u80fd\u589e\u52a0 SSR \u3001CSR \u4ee5\u53ca\u591a\u9875\u9762                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3807543\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yhyh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u597d\u6d3b\uff0c\u6211\u9876\u3002 \u51b3\u5b9a\u642c\u8fd0\u4f60\u7684 webpack \u914d\u7f6e \u81ea\u5df1\u73a9\u73a9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3807544\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : LiuJiang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @fewok \u5bf9\uff0c\u8fd9\u4e9b\u90fd\u662f\u811a\u624b\u67b6\uff0c\u800c\u6211\u8fd9\u4e2a\u662f\u9879\u76ee\u6a21\u677f\uff0c\u6211\u8ddf\u4ed6\u4eec\u7684\u533a\u522b\uff0c\u5c31\u662f\u5b8c\u5168\u81ea\u5b9a\u4e49\uff0c\u968f\u4fbf\u4f60\u600e\u4e48\u73a9\uff0c\u6211\u53ea\u63d0\u4f9b\u4e00\u4e2a\u9879\u76ee\u6a21\u677f\uff0c\u5982\u4f55\u7ec4\u5408\u90fd\u662f\u81ea\u5df1\u7684\u4e8b\u3002\u968f\u4fbf\u4f60\u73a9\u51fa\u82b1\u6765\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3807545\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : LiuJiang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yhyh \u7ed9\u4f60\u70b9\u4e2a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u4e8e React\u3001Mobx\u3001Web&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\/172801"}],"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=172801"}],"version-history":[{"count":1,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/172801\/revisions"}],"predecessor-version":[{"id":172805,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/172801\/revisions\/172805"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=172801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=172801"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=172801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}