{"id":325248,"date":"2021-02-05T03:14:11","date_gmt":"2021-02-04T19:14:11","guid":{"rendered":"http:\/\/4563.org\/?p=325248"},"modified":"2021-02-05T03:14:11","modified_gmt":"2021-02-04T19:14:11","slug":"%e7%94%a8%e4%ba%86%e4%b8%80%e4%b8%8b-snowpack-%e5%92%8c-vite%ef%bc%8c%e6%88%91%e6%84%8f%e8%af%86%e5%88%b0-2021-%e5%b9%b4%ef%bc%8c%e5%b7%b2%e7%bb%8f%e5%88%b0%e4%ba%86%e5%90%8e-webpack-%e7%9a%84","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=325248","title":{"rendered":"\u7528\u4e86\u4e00\u4e0b Snowpack \u548c Vite\uff0c\u6211\u610f\u8bc6\u5230 2021 \u5e74\uff0c\u5df2\u7ecf\u5230\u4e86\u540e webpack \u7684\u65f6\u4ee3\u4e86"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u7528\u4e86\u4e00\u4e0b Snowpack \u548c Vite\uff0c\u6211\u610f\u8bc6\u5230 2021 \u5e74\uff0c\u5df2\u7ecf\u5230\u4e86\u540e webpack \u7684\u65f6\u4ee3\u4e86               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Cbdy <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u611f\u8c22RequireJS \uff08 2009 \uff09\uff0c\u611f\u8c22AMD \uff08 2009 \uff09\uff0c\u611f\u8c22CommonJS \uff08 2009 \uff09\uff0c\u611f\u8c22UMD \uff08 2011 \uff09\uff0c\u611f\u8c22webpack \uff08 2012 \uff09\uff0c\u611f\u8c22SystemJS \uff08 2013 \uff09\uff0c\u611f\u8c22Rollup \uff08 2015 \uff09&#8230;<\/p>\n<p>\u5728\u524d\u7aef\u7b5a\u8def\u84dd\u7f15\u7684\u9636\u6bb5\uff0c\u8fd9\u4e9b\u5148\u9a71\u63a2\u7d22\u4e86\u524d\u7aef\u6a21\u5757\u5316\u7684\u9053\u8def\uff0c\u4f5c\u4e86\u8270\u82e6\u5353\u7edd\u53c8\u7edd\u5999\u7684\u5c1d\u8bd5\u548c\u52c7\u6562\u7684\u5b9e\u8df5\uff0c\u8ba9 Web \u3001\u8ba9\u6d4f\u89c8\u5668\u6210\u4e3a\u8fd9\u9897\u661f\u7403\u6700\u5f3a\u5927\u7684\u8f6f\u4ef6\u5e73\u53f0\uff0c\u4e5f\u4e3a\u4fc3\u6210\u4e86ES Modules \uff08 2015 &#8211; Now \uff09\u8bde\u751f\u548c\u5b8c\u5584<\/p>\n<p>\u524d\u7aef\u6a21\u5757\u5316\uff0c\u4f5c\u4e3a Web \u524d\u7aef\u8f6f\u4ef6\u5de5\u7a0b\u63a7\u5236\u590d\u6742\u5ea6\u6700\u91cd\u8981\u7684\u4e00\u73af\uff0c\u662f\u65f6\u5019\u6380\u5f00\u65b0\u7684\u7bc7\u7ae0\u4e86<\/p>\n<p>\u6b63\u5982\u201cjQuery \u5df2\u6b7b\uff0cjQuery \u4e07\u5c81\u201d\u6240\u8bf4\u5f97\u90a3\u6837\uff0c\u65b0\u7684\u6784\u5efa\u5de5\u5177\u7ad9\u5728\u201c\u524d\u8f88\u201d\u80a9\u8180\u4e0a\uff0c\u5438\u6536\u4e86\u8bf8\u5982 import everything \u3001import alias \u3001HMR \u7b49\u4eba\u6c11\u7fa4\u4f17\u559c\u95fb\u4e50\u89c1\u7684\u7279\u6027\uff0c\u4ee5 ESM \u4e3a\u57fa\u7840\uff0cEverything compiled to ESM\uff0c\u540c\u65f6\u5728 ESM \u7684\u57fa\u7840\u4e0a\uff0c\u63d0\u4f9b\u56de\u9000\u5230 Bundle \u4ee5\u517c\u5bb9\u8001\u6d4f\u89c8\u5668\u7684\u53ef\u9009\u9879<\/p>\n<p>\u73b0\u5728\uff0cES Modules \u4f17\u671b\u6240\u5f52\uff0c\u5404\u4e2a\u7279\u6027\u4f17\u661f\u5f52\u4f4d\uff0c\u626b\u5c3d\u6c89\u75b4\u3002Snowpack \uff08 2019 \uff09\u548cVite \uff08 2020 \uff09\uff0c\u4ee5 ESM \u4e3a\u57fa\u7840\uff0c\u9ad8\u4e3e\u7684 Bundleless \u65d7\u5e1c\uff0c\u4ee5 ES \u6807\u51c6\u7684\u529b\u91cf\uff0c\u5728 92%\u7684 ESM \u652f\u6301\u7387\uff0c96%\u7684 HTTP2 \u652f\u6301\u7387\u4e0b\uff08 caniuse \u7684\u6570\u636e\uff09\u7684\u73b0\u5728\uff0c\u5f00\u542f\u524d\u7aef\u65b0\u7684\u65f6\u4ee3<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>14<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5211104\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lostberryzz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u829c\u6e56\u8d77\u98de\uff5e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211105\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : carlhan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u6709 preact team \u505a\u7684 wmr https:\/\/github.com\/preactjs\/wmr                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211106\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jirajine <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u91cd\u590d\u9020\u8f6e\u5b50\u4e25\u91cd\u3002snowpack \u548c vite \u529f\u80fd\u7279\u6027\u51e0\u4e4e\u5b8c\u5168\u76f8\u540c\uff0c\u524d\u8005 svelte \u3001react \u652f\u6301\u8f83\u597d\uff0cvue \u652f\u6301\u4e00\u822c\uff0c\u540e\u8005 vue \u652f\u6301\u8f83\u597d\uff0c\u5176\u4ed6\u652f\u6301\u4e00\u822c\u3002<br \/>\u5c31\u4e0d\u80fd\u7edf\u5408\u4e00\u4e0b\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211107\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : noqwerty <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Jirajine \u524d\u7aef\u4e3a\u5565\u90fd\u60f3\u6709\u4e00\u4e2a\u5927\u4e00\u7edf\u7684\u5f00\u53d1\u5de5\u5177\u5462\uff1f\u8fd9\u6837\u5230\u6700\u540e\u4e0d\u5c31\u53c8\u53d8\u6210\u4e86\u91cd\u5f97\u7c7b\u4f3c webpack \u7684\u5de5\u5177                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211108\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : muzuiget <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7a0d\u5fae\u770b\u4e86\u4e00\u4e0b\uff0c\u8fd8\u662f\u7ee7\u7eed webpack\uff0c\u90a3\u4e9b\u53f7\u79f0\u6bd4 webpack \u914d\u7f6e\u7b80\u5355\u7684\uff0c\u65e0\u975e\u90fd\u662f\u8981\u6c42\u4f60\u6309\u7167\u67d0\u4e2a\u7279\u5b9a\u65b9\u5f0f\u7ec4\u7ec7\u4ee3\u7801\uff0c\u672c\u8d28\u505a\u4e86\u95f4\u63a5\u914d\u7f6e\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211109\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Cbdy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @muzuiget \u60a8\u770b\u9519\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211110\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imjamespond <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             webpack \u652f\u6301\u4ee3\u7801\u5206\u5272\uff0cdev server, loader plugin \u4e30\u5bcc\uff0c\u4f46\u662f\u4e0d\u80fd es module? \u4e0a\u9762\u7684\u6b63\u597d\u53cd\u8fc7\u6765\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211111\" 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>                                                             \u4e4b\u524d\u5728\u4e2a\u4eba\u9879\u76ee\u91cc\u8bd5\u7528\u4e86\u4e00\u4e0b snowpack\uff0c\u597d\u50cf\u8ddf\u4e00\u4e9b\u5947\u5947\u602a\u602a\u7684\u5305\u4e0d\u517c\u5bb9\uff0c\u4f8b\u5982\u4e07\u5e74\u4e0d\u66f4\u65b0\u7684 styled-jsx\uff0c\u611f\u89c9\u8fd8\u662f\u9700\u8981\u70b9\u65f6\u95f4\u7684\u6837\u5b50<\/p>\n<p>\u4efb\u4f60\u51fa\u8d70\u534a\u751f\uff0c\u5f52\u6765\u8fd8\u662f webpack                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211112\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : acthtml <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c24\u5927\u5c31\u559c\u6b22\u9ad8\u5ea6\u5b9a\u5236\u5316\u7684\u4e1c\u897f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211113\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gouflv <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u731c webpack \u652f\u6301 esm dev \u662f\u5206\u5206\u949f\u7684\u4e8b\u60c5\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211114\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : runze <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5929\u4e0b\u82e6 webpack \u4e45\u77e3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211115\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : murmur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             webpack \u633a\u597d\u7684\uff0c\u6253\u5305\u6162\u4e0d\u8981\u7d27\uff0c\u90a3\u662f\u559d\u6c34\u4e0a\u5395\u6240\u7684\u65f6\u95f4\uff0c\u6162\u5c31\u8ba9\u8001\u677f\u6362\u7535\u8111<\/p>\n<p>\u6253\u5de5\u4eba\u8981\u5b66\u4f1a\u4fdd\u517b\u81ea\u5df1                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211116\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gdrk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             webpack \u4e4b\u540e\u5e94\u8be5\u4e5f\u4f1a\u4e0a\u5427\uff0c\u6253\u5305\u5de5\u5177\u641e\u90a3\u4e48\u591a\u8f6e\u5b50\u771f\u7684\u5934\u75bc                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5211117\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lancelock <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             snowpack \u7528\u8d77\u6765\u4e0d\u9519\uff0c\u4e0d\u8fc7\u6211\u4e5f\u4e0d\u60f3\u5199\u524d\u7aef\u4e86\u3002\u6700\u8fd1\u611f\u89c9 blazor \u633a\u6709\u610f\u601d\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u7528\u4e86\u4e00\u4e0b Snowpack \u548c V&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\/325248"}],"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=325248"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/325248\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=325248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=325248"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=325248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}