{"id":80,"date":"2022-02-15T23:05:22","date_gmt":"2022-02-15T15:05:22","guid":{"rendered":"http:\/\/weboob.top\/blog\/?p=80"},"modified":"2022-02-15T23:05:22","modified_gmt":"2022-02-15T15:05:22","slug":"webpack%e5%ad%a6%e4%b9%a0%ef%bc%88%ef%bc%89","status":"publish","type":"post","link":"http:\/\/blog.weboob.top\/?p=80","title":{"rendered":"webpack\u5b66\u4e60\uff08\u4e00\uff09"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u4e00\u3001\u540d\u8bcd\u89e3\u91ca<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>bundle<br \/>\u8d44\u6e90\u5305\uff0c\u5305\u542b\u53ef\u6267\u884c\u7a0b\u5e8f\uff0c\u9759\u6001\u8d44\u6e90\u7b49<\/li><li>chunk<br \/>\u6a21\u5757\uff0c\u5c0f\u4e8e\u5b8c\u6574\u7a0b\u5e8f\u7684\u4f53\u79ef\uff0c\u65b9\u4fbf <strong><em>\u9a8c\u8bc1\u3001\u8c03\u8bd5\u3001\u6d4b\u8bd5<\/em><\/strong>\uff0c\u63d0\u4f9b\u4e86\u53ef\u9760\u7684\u5c01\u88c5\u548c\u62bd\u8c61\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e8c\u3001\u6982\u5ff5<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u901a\u8fc7\u4e00\u4e2a\u6216\u591a\u4e2a\u5165\u53e3\u6784\u5efa <a href=\"https:\/\/webpack.docschina.org\/concepts\/dependency-graph\/\">\u4f9d\u8d56\u56fe\uff08dependency graph\uff09<\/a>\uff0c\u7136\u540e\u5c06\u9879\u76ee\u4e2d\u7684 <strong><em>chunk<\/em><\/strong> \u7ec4\u5408\u6210\u4e00\u4e2a\u6216\u591a\u4e2a <strong><em>bundle<\/em><\/strong> \u3002<\/p><\/blockquote>\n\n\n\n<h5 class=\"wp-block-heading\">\u6838\u5fc3\u6982\u5ff5\uff1a<\/h5>\n\n\n\n<ol class=\"wp-block-list\"><li>entry\uff08\u5165\u53e3\uff09\uff1a\u6253\u5305\u7684\u8d77\u70b9\u6587\u4ef6<\/li><\/ol>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u9ed8\u8ba4\uff1a.\/src\/index.js<br \/>\u53ef\u5728 <strong>webpack configuration<\/strong> \u4e2d\u5355\u72ec\u914d\u7f6e<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- webpack.config.js --\n\nmodule.exports = {\n    entry: '.\/path\/to\/my\/entry\/file.js',\n}<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\"><li>output\uff08\u8f93\u51fa\uff09\uff1a\u6253\u5305 bundle \u7684\u5b58\u50a8\u8def\u5f84\u53ca\u547d\u540d\u65b9\u5f0f<\/li><\/ol>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u9ed8\u8ba4\u4e3b\u6587\u4ef6\uff1a.\/dist\/main.js<br \/>\u9ed8\u8ba4\u5176\u4ed6\u6587\u4ef6\uff1a.\/dist<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- webpack.config.js --\n\nmodule.exports={\n    entry: '.\/path\/to\/my\/entry\/file.js',\n    output: {\n        path: path.resole(__dirname, 'dist'),\n        filename: 'my-first-webpack.bundle.js',\n    },\n}<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\"><li>loader<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u540d\u8bcd\u89e3\u91ca bundle\u8d44\u6e90\u5305\uff0c\u5305\u542b\u53ef\u6267\u884c\u7a0b\u5e8f\uff0c\u9759\u6001\u8d44\u6e90\u7b49 chunk\u6a21\u5757\uff0c\u5c0f\u4e8e\u5b8c\u6574\u7a0b\u5e8f\u7684\u4f53\u79ef\uff0c\u65b9\u4fbf \u9a8c\u8bc1\u3001 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,5],"tags":[],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-webpack","category-code_article"],"_links":{"self":[{"href":"http:\/\/blog.weboob.top\/index.php?rest_route=\/wp\/v2\/posts\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.weboob.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.weboob.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.weboob.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.weboob.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=80"}],"version-history":[{"count":0,"href":"http:\/\/blog.weboob.top\/index.php?rest_route=\/wp\/v2\/posts\/80\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.weboob.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.weboob.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.weboob.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}