{"id":229163,"date":"2020-12-11T08:24:04","date_gmt":"2020-12-11T00:24:04","guid":{"rendered":"http:\/\/4563.org\/?p=229163"},"modified":"2020-12-11T08:24:04","modified_gmt":"2020-12-11T00:24:04","slug":"%e6%b1%82%e5%8a%a9-%e5%a6%82%e4%bd%95-publish-%e4%b8%80%e4%b8%aa%e5%9f%ba%e4%ba%8e-react%ef%bc%8c-typescript-%e5%92%8c-sass-%e5%bc%80%e5%8f%91%e7%9a%84%e7%bb%84%e4%bb%b6%e5%88%b0-npm-%e5%91%a2","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=229163","title":{"rendered":"[\u6c42\u52a9] \u5982\u4f55 Publish \u4e00\u4e2a\u57fa\u4e8e React\uff0c Typescript \u548c SASS \u5f00\u53d1\u7684\u7ec4\u4ef6\u5230 NPM \u5462\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  [\u6c42\u52a9] \u5982\u4f55 Publish \u4e00\u4e2a\u57fa\u4e8e React\uff0c Typescript \u548c SASS \u5f00\u53d1\u7684\u7ec4\u4ef6\u5230 NPM \u5462\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LiubaiQ <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e07\u80fd\u7684 V \u53cb\u554a\uff0c\u6709\u719f\u6089 typescript\uff0cwebpack \u548c npm package \u7684\u5927\u4f6c\u5e0c\u671b\u89e3\u7b54\u4e0b\u6211\u7684\u7591\u60d1\uff0c\u4e07\u5206\u611f\u8c22 QAQ<\/p>\n<p>\u5b57\u591a\u61d2\u770b\u7684\u5927\u4f6c\u8bf7\u76f4\u63a5\u770b\u95ee\u9898~<\/p>\n<p>\u56e0\u4e3a\u60f3\u8981\u53d1\u5e03\u4e00\u4e2a React \u7ec4\u4ef6\u5305\u5230 NPM \u4e0a\uff0c\u5f00\u53d1\u65f6\u4f7f\u7528\u4e86 SASS\uff0c\u5c31\u53d1\u73b0\u76f4\u63a5\u4f7f\u7528<code>tsc<\/code>\u6307\u4ee4\uff0c\u7f16\u8bd1\u540e\u7684\u8d44\u6e90\u4e2d\u5bfc\u5165 SASS \u7684\u8bed\u53e5\u8fd8\u5728\uff0c\u4f46\u6ca1\u6709.scss \u6587\u4ef6\uff0c\u6240\u4ee5\u7b2c\u4e00\u6ce2\u95ee\u9898\u5c31\u662f\uff1a<\/p>\n<ol>\n<li>Typescript \u662f\u5426\u6709\u4e00\u79cd\u673a\u5236\u53ef\u4ee5\u5305\u542b\u975e\u4ee3\u7801\u8d44\u6e90\u5230\u7f16\u8bd1\u540e\u7684\u4e00\u5806\u6587\u4ef6\u4e2d\u5462\uff1f<\/li>\n<li>\u80fd\u5426\u5728\u7f16\u8bd1\u524d\u540e\u67d0\u4e2a\u65f6\u673a\u628a SASS \u4e5f\u7f16\u8bd1\u6210 CSS \u5462\uff1f\uff08\u8fdb\u9636\uff09<\/li>\n<li>\u80fd\u5426\u628a 1 \u548c 2 \u901a\u8fc7\u4ec0\u4e48\u65b9\u6cd5\uff08\u4e5f\u8bb8 npm script?\uff09\u5c01\u88c5\u5230\u540c\u4e00\u4e2a\u8fc7\u7a0b\u4e2d\u5462\uff1f\uff08\u8fdb\u8fdb\u9636\uff09<\/li>\n<\/ol>\n<p>\u7136\u540e\u7531\u4e8e\u4e0a\u8ff0\u601d\u8def\u6ca1\u6709\u627e\u5230\u89e3\u51b3\u65b9\u6848\uff0c\u6240\u4ee5\u6362\u4e86\u4e00\u79cd\u601d\u8def\uff0c\u901a\u8fc7 Webpack \u914d\u7f6e ts-loader \u6784\u5efa\uff0c\u597d\u5904\u662f\u53ef\u4ee5\u901a\u8fc7 sass\/css\/style-loader \u5c06\u6837\u5f0f\u5185\u8054\u5230\u6784\u5efa\u51fa\u7684 bundle.js \u4e2d\uff0c\u4f46\u662f\u53c8\u53d1\u73b0 ts-loader \u867d\u7136\u53ef\u4ee5\u4f9d\u8d56\u4e8e tsconfig.json \u914d\u7f6e\u89e3\u6790 ts\uff0c\u4f46\u4e0d\u652f\u6301\u8f93\u51fa<code>.d.ts<\/code> \u7c7b\u578b\u58f0\u660e\u6587\u4ef6\uff0c\u4e5f\u5c31\u662f\u8bf4 declaration \u5b57\u6bb5\u662f\u65e0\u6548\u7684\uff0c\u770b github \u4e0a ts-loader \u7684 issues \u91cc\u5934\u4f5c\u8005\u5df2\u7ecf\u660e\u786e\u8868\u793a\u4e0d\u652f\u6301\u8fd9\u4e2a\u884c\u4e3a\uff0c\u6240\u4ee5\u7b2c\u4e8c\u6ce2\u95ee\u9898\u662f\uff1a<\/p>\n<ol>\n<li>\u6709\u5176\u4ed6\u7c7b\u4f3c ts-loader \u7684 package \u53ef\u4ee5\u8f93\u51fa\u7c7b\u578b\u58f0\u660e\u6587\u4ef6\u5417\uff1f<\/li>\n<li>\u9664\u4e86\u4e0a\u8ff0\u4e24\u79cd\u601d\u8def\uff0c\u6709\u4ec0\u4e48\u66ff\u4ee3\u65b9\u6848\u5417\uff1f<\/li>\n<\/ol><\/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=\"4699971\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ruoxie <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             rollup                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4699972\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : LiubaiQ <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5927\u4f6c\u4eec\u56de\u590d\u6211\u4e00\u4e0b\u554a\u3002\u3002\u3002\u6700\u540e\u6ca1\u529e\u6cd5\u7684\u8bdd\u6211\u5c31\u53ea\u80fd\u901a\u8fc7 Node API \u786c\u751f\u6210 CSS \u6587\u4ef6\u5230\u7f16\u8bd1\u540e\u7684\u8d44\u6e90\u4e2d\u4e86\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4699973\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : LiubaiQ <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ruoxie \u5b66\u5230\u4e86\uff0cthx \uff01                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4699974\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : LiubaiQ <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6b64\u8d34\u7ec8\u7ed3\uff0c\u89e3\u51b3\u65b9\u6848\u53ef\u4ee5\u53c2\u7167<br \/>blog.maihaoche.com\/typescript-rollup-da-jian-gong-ju-ku\/                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4699975\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ljwrer <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u76f4\u63a5\u7528 create-react-library \u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>[\u6c42\u52a9] \u5982\u4f55 Publish \u4e00&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\/229163"}],"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=229163"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/229163\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=229163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=229163"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=229163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}