{"id":70335,"date":"2026-02-01T19:42:08","date_gmt":"2026-02-01T11:42:08","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/70335.html"},"modified":"2026-02-01T19:42:08","modified_gmt":"2026-02-01T11:42:08","slug":"webpack-%e7%9a%84%e5%ae%89%e8%a3%85%e5%8f%8a%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/70335.html","title":{"rendered":"webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528"},"content":{"rendered":"<h2 id=\"\"><\/h2>\n<h2 id=\"webpack%C2%A0%E5%AE%98%E7%BD%91\">webpack\u00a0<\/h2>\n<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"webpack%C2%A0%E5%AE%98%E7%BD%91-toc\" style=\"margin-left:0px\">webpack\u00a0\u5b98\u7f51<\/p>\n<p id=\"%E5%AE%89%E8%A3%85%E5%91%BD%E4%BB%A4%E5%8F%8A%E9%85%8D%E7%BD%AE-toc\" style=\"margin-left:0px\">\u5b89\u88c5\u547d\u4ee4\u53ca\u914d\u7f6e<\/p>\n<p id=\"1.%E5%AE%89%E8%A3%85yarn-toc\" style=\"margin-left:80px\">1.\u5b89\u88c5yarn<\/p>\n<p id=\"2.%E5%88%9D%E5%A7%8B%E5%8C%96%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:80px\">2.\u521d\u59cb\u5316\u6587\u4ef6<\/p>\n<p id=\"4.%E5%88%9B%E5%BB%BAsrc%E6%96%87%E4%BB%B6%E5%A4%B9%EF%BC%8C%20%E5%9C%A8src%E4%B8%8B%E5%88%9B%E5%BB%BAindex.js%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:80px\">4.\u521b\u5efasrc\u6587\u4ef6\u5939&#xff0c; \u5728src\u4e0b\u521b\u5efaindex.js\u6587\u4ef6<\/p>\n<p id=\"5.%E9%85%8D%E7%BD%AEwebpack-toc\" style=\"margin-left:80px\">5.\u914d\u7f6ewebpack<\/p>\n<p id=\"7.%E5%85%A5%E5%8F%A3%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:80px\">7.\u5165\u53e3\u6587\u4ef6<\/p>\n<p id=\"%E7%AC%AC%E4%B8%80%E7%A7%8D-toc\" style=\"margin-left:120px\">\u7b2c\u4e00\u79cd<\/p>\n<p id=\"%E7%AC%AC%E4%BA%8C%E7%A7%8D-toc\" style=\"margin-left:120px\">\u7b2c\u4e8c\u79cd<\/p>\n<p id=\"%E7%AC%AC%E4%B8%89%E7%A7%8D-toc\" style=\"margin-left:120px\">\u7b2c\u4e09\u79cd<\/p>\n<p id=\"8.%E5%87%BA%E5%8F%A3%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:80px\">8.\u51fa\u53e3\u6587\u4ef6<\/p>\n<p id=\"9.%E6%A8%A1%E5%BC%8F-toc\" style=\"margin-left:80px\">9.\u6a21\u5f0f<\/p>\n<p id=\"10.%E5%BC%80%E5%8F%91%E6%9C%8D%E5%8A%A1%E5%99%A8-toc\" style=\"margin-left:80px\">10.\u5f00\u53d1\u670d\u52a1\u5668<\/p>\n<p id=\"%E6%B3%A8%E6%84%8F%E4%BA%8B%E4%BB%B6-toc\" style=\"margin-left:40px\">\u6ce8\u610f\u4e8b\u4ef6<\/p>\n<p id=\"%E4%BD%BF%E7%94%A8%E5%AE%9E%E4%BE%8B-toc\" style=\"margin-left:0px\">\u4f7f\u7528\u5b9e\u4f8b<\/p>\n<p id=\"Loaders-toc\" style=\"margin-left:40px\">Loaders<\/p>\n<p id=\"%E4%B8%BE%E4%BE%8B%EF%BC%9A-toc\" style=\"margin-left:40px\">\u4e3e\u4f8b&#xff1a;<\/p>\n<p id=\"1.%E5%BC%95%E5%85%A5CSS%E5%8F%8ASTML%E6%A0%B7%E5%BC%8F-toc\" style=\"margin-left:80px\">1.\u5f15\u5165CSS\u53caSTML\u6837\u5f0f<\/p>\n<p id=\"style.css-toc\" style=\"margin-left:120px\">style.css<\/p>\n<p id=\"repo-read-file-toc\" style=\"margin-left:120px\">\u5728webpack.config.js<\/p>\n<hr id=\"hr-toc\" \/>\n<h2>\u5b98\u7f51<\/h2>\n<p>https:\/\/webpack.docschina.org\/<\/p>\n<h2 id=\"%E5%AE%89%E8%A3%85%E5%91%BD%E4%BB%A4%E5%8F%8A%E9%85%8D%E7%BD%AE\">\u5b89\u88c5\u547d\u4ee4\u53ca\u914d\u7f6e<\/h2>\n<p>\u672c\u7248\u672c\u901a\u8fc7yarn\u6765\u5b89\u88c5<\/p>\n<h4 id=\"1.%E5%AE%89%E8%A3%85yarn\" style=\"margin-left:0px;margin-right:0px\">1.\u5b89\u88c5yarn <\/h4>\n<p style=\"margin-left:0;margin-right:0\">npm install yarn -g<\/p>\n<h4 id=\"2.%E5%88%9D%E5%A7%8B%E5%8C%96%E6%96%87%E4%BB%B6\" style=\"margin-left:0px;margin-right:0px\">2.\u521d\u59cb\u5316\u6587\u4ef6<\/h4>\n<p style=\"margin-left:0;margin-right:0\">\u00a0yarn init -y<\/p>\n<p style=\"margin-left:0px;margin-right:0px\">3.\u5b89\u88c5webpack <\/p>\n<p style=\"margin-left:0;margin-right:0\">yarn add -D webpack webpack-cli<\/p>\n<h4 id=\"4.%E5%88%9B%E5%BB%BAsrc%E6%96%87%E4%BB%B6%E5%A4%B9%EF%BC%8C%20%E5%9C%A8src%E4%B8%8B%E5%88%9B%E5%BB%BAindex.js%E6%96%87%E4%BB%B6\" style=\"margin-left:0px;margin-right:0px\">4.\u521b\u5efasrc\u6587\u4ef6\u5939&#xff0c; \u5728src\u4e0b\u521b\u5efaindex.js\u6587\u4ef6<\/h4>\n<h4 id=\"5.%E9%85%8D%E7%BD%AEwebpack\" style=\"margin-left:0px;margin-right:0px\">5.\u914d\u7f6ewebpack <\/h4>\n<p style=\"margin-left:0;margin-right:0\">\u5728\u6839\u76ee\u5f55&#xff0c;\u521b\u5efawebpack.config.js<\/p>\n<p style=\"margin-left:0px;margin-right:0px\">6.\u6253\u5305\u547d\u4ee4 <\/p>\n<p style=\"margin-left:0;margin-right:0\">yarn webpack<\/p>\n<p style=\"margin-left:0;margin-right:0\">\u53d1\u51fa\u6253\u5305\u547d\u4ee4\u540e&#xff0c;\u4f1a\u5728\u6839\u6587\u4ef6\u4e0b\u5efa\u7acbdist\u6587\u4ef6\u5939<\/p>\n<p style=\"margin-left:0;margin-right:0\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"48\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260201114207-697f3c0f3bfbd.png\" width=\"209\" \/><\/p>\n<h4 id=\"7.%E5%85%A5%E5%8F%A3%E6%96%87%E4%BB%B6\" style=\"margin-left:0px;margin-right:0px\">7.\u5165\u53e3\u6587\u4ef6<\/h4>\n<p style=\"margin-left:0;margin-right:0\">\u67093\u79cd\u65b9\u5f0f\u914d\u7f6e\u5165\u53e3\u6587\u4ef6&#xff1a;<\/p>\n<h5 id=\"%E7%AC%AC%E4%B8%80%E7%A7%8D\" style=\"margin-left:0px;margin-right:0px\">\u7b2c\u4e00\u79cd<\/h5>\n<p style=\"margin-left:0;margin-right:0\">entry: &#039;.\/src\/hello.js&#039;<\/p>\n<h5 id=\"%E7%AC%AC%E4%BA%8C%E7%A7%8D\" style=\"margin-left:0px;margin-right:0px\">\u7b2c\u4e8c\u79cd<\/h5>\n<p style=\"margin-left:0;margin-right:0\">\u00a0entry: [&#039;.\/src\/hello.js&#039;,&#039;.\/src\/index.js&#039;]<\/p>\n<h5 id=\"%E7%AC%AC%E4%B8%89%E7%A7%8D\" style=\"margin-left:0px;margin-right:0px\">\u7b2c\u4e09\u79cd<\/h5>\n<p style=\"margin-left:0;margin-right:0\">\u00a0entry: { a:&#039;.\/src\/hello.js&#039;, b:&#039;.\/src\/index.js&#039; }<\/p>\n<h4 id=\"8.%E5%87%BA%E5%8F%A3%E6%96%87%E4%BB%B6\" style=\"margin-left:0px;margin-right:0px\">8.\u51fa\u53e3\u6587\u4ef6<\/h4>\n<p>\u51fa\u53e3\u6587\u4ef6\u5185\u5bb9\u5728output\u5199\u5165<\/p>\n<p style=\"margin-left:0;margin-right:0\">output: {&#8230; }<\/p>\n<p style=\"margin-left:0;margin-right:0\">\u5176\u4e2d<\/p>\n<li>filename:&#039;[name]-[id]-[hash].js&#039;\u00a0 \u00a0\u6307\u5b9a\u6253\u5305\u6587\u4ef6\u540d\u79f0<\/li>\n<li>clean: true\u00a0 \u6e05\u7a7a\u6253\u5305\u6587\u4ef6<\/li>\n<li>path: path.resolve(__dirname, &#039;dist&#039;)\u00a0\u6307\u5b9a\u6253\u5305\u4f4d\u7f6e<\/li>\n<h4 id=\"9.%E6%A8%A1%E5%BC%8F\" style=\"margin-left:0px;margin-right:0px\">9.\u6a21\u5f0f<\/h4>\n<p style=\"margin-left:0;margin-right:0\">\u00a0mode:&#034;production&#034; \/ &#034;development&#034;<\/p>\n<h4 id=\"10.%E5%BC%80%E5%8F%91%E6%9C%8D%E5%8A%A1%E5%99%A8\" style=\"margin-left:0px;margin-right:0px\">10.\u5f00\u53d1\u670d\u52a1\u5668<\/h4>\n<p style=\"margin-left:0;margin-right:0\">yarn add -D webpack-dev-server yarn webpack serve \u6253\u5305\u670d\u52a1\u5668<\/p>\n<p style=\"margin-left:0;margin-right:0\">yarn webpack serve &#8211;open \u81ea\u52a8\u6253\u5305<\/p>\n<h3 id=\"%E6%B3%A8%E6%84%8F%E4%BA%8B%E4%BB%B6\">\u6ce8\u610f\u4e8b\u4ef6<\/h3>\n<p>1.\u51fa\u53e3\u6587\u4ef6\u548c\u5165\u53e3\u6587\u4ef6\u5bf9\u5f97\u5728webpack.config.js\u4e0b\u914d\u7f6e<\/p>\n<p>2.\u5f97\u5728module.exports &#061; {&#8230;}\u4e0b\u5199<\/p>\n<p>3.\u522b\u5fd8\u4e86\u521b\u5efa\u4e00\u4e2aHTML\u9875\u9762\u65b9\u4fbf\u67e5\u770b\u54e6<\/p>\n<p>4.\u4e5f\u522b\u5fd8\u5728HTML\u5f15\u5165\u6253\u5305\u6587\u4ef6<\/p>\n<p> &lt;script src&#061;&#034;.\/dist\/main.js&#034;&gt;&lt;\/script&gt; <\/p>\n<hr \/>\n<h2 id=\"%E4%BD%BF%E7%94%A8%E5%AE%9E%E4%BE%8B\" style=\"margin-left:0px;margin-right:0px\">\u4f7f\u7528\u5b9e\u4f8b<\/h2>\n<p style=\"margin-left:0;margin-right:0\">\u7531\u4e8e\u4e3a\u4e86\u4fdd\u8bc1\u6587\u4ef6\u6253\u5305\u4f53\u79ef\u4e0d\u4f1a\u592a\u5927&#xff0c;\u6240\u4ee5\u53ea\u8bc6\u522bJS\u6587\u4ef6<\/p>\n<p style=\"margin-left:0;margin-right:0\">\u56e0\u6b64\u5982\u679c\u8981\u5199CSS\u53ca\u5176\u4ed6\u7c7b\u578b\u7684\u6587\u4ef6\u9700\u8981\u5f15\u5165Loaders<\/p>\n<h3 id=\"Loaders\" style=\"margin-left:0px;margin-right:0px\">Loaders<\/h3>\n<p style=\"margin-left:0;margin-right:0\">Webpack \u652f\u6301\u4f7f\u7528\u00a0loader\u00a0\u5bf9\u6587\u4ef6\u8fdb\u884c\u9884\u5904\u7406\u3002\u4f60\u53ef\u4ee5\u6784\u5efa\u5305\u62ec JavaScript \u5728\u5185\u7684\u4efb\u4f55\u9759\u6001\u8d44\u6e90\u3002\u5e76\u4e14\u53ef\u4ee5\u4f7f\u7528 Node.js \u8f7b\u677e\u7f16\u5199\u81ea\u5df1\u7684 loader\u3002<\/p>\n<p style=\"margin-left:0;margin-right:0\">\u8be6\u60c5\u53ef\u8fdb\u5165\u5b98\u7f51\u67e5\u9605<\/p>\n<h3 id=\"%E4%B8%BE%E4%BE%8B%EF%BC%9A\" style=\"margin-left:0px;margin-right:0px\">\u4e3e\u4f8b&#xff1a;<\/h3>\n<h4 id=\"1.%E5%BC%95%E5%85%A5CSS%E5%8F%8ASTML%E6%A0%B7%E5%BC%8F\" style=\"margin-left:0px;margin-right:0px\">1.\u5f15\u5165CSS\u53caSTML\u6837\u5f0f<\/h4>\n<p>npm install &#8211;save-dev style-loader <\/p>\n<h5 id=\"style.css\">\u5728style.css<\/h5>\n<p>body {<br \/>\n  background: green;<br \/>\n} <\/p>\n<h5 id=\"repo-read-file\">\u5728webpack.config.js<\/h5>\n<p>    module: {<br \/>\n        rules: [<br \/>\n            {<br \/>\n                test: \/\\\\.css$\/i,<br \/>\n                use: [&#039;style-loader&#039;, &#039;css-loader&#039;],<br \/>\n            },<br \/>\n]<br \/>\n} <\/p>\n<p>2.\u56fe\u7247<\/p>\n<p> module: {<br \/>\n        rules: [<br \/>\n            {<br \/>\n                \/\/ png|svg|jpg|jpeg|gif \u533a\u522b<br \/>\n                test: \/\\\\.(png|svg|jpg|jpeg|gif)$\/i,<br \/>\n                type: &#039;asset\/resource&#039;,<br \/>\n            },<br \/>\n]} <\/p>\n<p style=\"margin-left:0;margin-right:0\">\n<p style=\"margin-left:0;margin-right:0\">\n","protected":false},"excerpt":{"rendered":"<p>webpack\u00a0<br \/>\n\u76ee\u5f55<br \/>\nwebpack\u00a0\u5b98\u7f51<br \/>\n\u5b89\u88c5\u547d\u4ee4\u53ca\u914d\u7f6e<br \/>\n1.\u5b89\u88c5yarn<br \/>\n2.\u521d\u59cb\u5316\u6587\u4ef6<br \/>\n4.\u521b\u5efasrc\u6587\u4ef6\u5939&#xff0c; \u5728src\u4e0b\u521b\u5efaindex.js\u6587\u4ef6<br \/>\n5.\u914d\u7f6ewebpack<br \/>\n7.\u5165\u53e3\u6587\u4ef6<br \/>\n\u7b2c\u4e00\u79cd<br \/>\n\u7b2c\u4e8c\u79cd<br \/>\n\u7b2c\u4e09\u79cd<br \/>\n8.\u51fa\u53e3\u6587\u4ef6<br \/>\n9.\u6a21\u5f0f<br \/>\n10.\u5f00\u53d1\u670d\u52a1\u5668<br \/>\n\u6ce8\u610f\u4e8b\u4ef6<br \/>\n\u4f7f\u7528\u5b9e\u4f8b<br \/>\nLoaders<br \/>\n\u4e3e\u4f8b&#xff1a;<br \/>\n1.\u5f15\u5165CSS\u53caSTML\u6837\u5f0f<br \/>\nstyle.css<br \/>\n\u5728webpack.config.js \u5b98\u7f51<br \/>\nhttps<\/p>\n","protected":false},"author":2,"featured_media":70334,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[186,3099,87],"topic":[],"class_list":["post-70335","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-node-js","tag-webpack","tag-87"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/70335.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"webpack\u00a0 \u76ee\u5f55 webpack\u00a0\u5b98\u7f51 \u5b89\u88c5\u547d\u4ee4\u53ca\u914d\u7f6e 1.\u5b89\u88c5yarn 2.\u521d\u59cb\u5316\u6587\u4ef6 4.\u521b\u5efasrc\u6587\u4ef6\u5939&#xff0c; \u5728src\u4e0b\u521b\u5efaindex.js\u6587\u4ef6 5.\u914d\u7f6ewebpack 7.\u5165\u53e3\u6587\u4ef6 \u7b2c\u4e00\u79cd \u7b2c\u4e8c\u79cd \u7b2c\u4e09\u79cd 8.\u51fa\u53e3\u6587\u4ef6 9.\u6a21\u5f0f 10.\u5f00\u53d1\u670d\u52a1\u5668 \u6ce8\u610f\u4e8b\u4ef6 \u4f7f\u7528\u5b9e\u4f8b Loaders \u4e3e\u4f8b&#xff1a; 1.\u5f15\u5165CSS\u53caSTML\u6837\u5f0f style.css \u5728webpack.config.js \u5b98\u7f51 https\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/70335.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-01T11:42:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260201114207-697f3c0f3bfbd.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/70335.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/70335.html\",\"name\":\"webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-01T11:42:08+00:00\",\"dateModified\":\"2026-02-01T11:42:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/70335.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/70335.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/70335.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/70335.html","og_locale":"zh_CN","og_type":"article","og_title":"webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"webpack\u00a0 \u76ee\u5f55 webpack\u00a0\u5b98\u7f51 \u5b89\u88c5\u547d\u4ee4\u53ca\u914d\u7f6e 1.\u5b89\u88c5yarn 2.\u521d\u59cb\u5316\u6587\u4ef6 4.\u521b\u5efasrc\u6587\u4ef6\u5939&#xff0c; \u5728src\u4e0b\u521b\u5efaindex.js\u6587\u4ef6 5.\u914d\u7f6ewebpack 7.\u5165\u53e3\u6587\u4ef6 \u7b2c\u4e00\u79cd \u7b2c\u4e8c\u79cd \u7b2c\u4e09\u79cd 8.\u51fa\u53e3\u6587\u4ef6 9.\u6a21\u5f0f 10.\u5f00\u53d1\u670d\u52a1\u5668 \u6ce8\u610f\u4e8b\u4ef6 \u4f7f\u7528\u5b9e\u4f8b Loaders \u4e3e\u4f8b&#xff1a; 1.\u5f15\u5165CSS\u53caSTML\u6837\u5f0f style.css \u5728webpack.config.js \u5b98\u7f51 https","og_url":"https:\/\/www.wsisp.com\/helps\/70335.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-01T11:42:08+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260201114207-697f3c0f3bfbd.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/70335.html","url":"https:\/\/www.wsisp.com\/helps\/70335.html","name":"webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-01T11:42:08+00:00","dateModified":"2026-02-01T11:42:08+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/70335.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/70335.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/70335.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"webpack \u7684\u5b89\u88c5\u53ca\u4f7f\u7528"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/70335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=70335"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/70335\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/70334"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=70335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=70335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=70335"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=70335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}