{"id":53134,"date":"2024-12-03T09:44:37","date_gmt":"2024-12-03T01:44:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53134\/"},"modified":"2024-12-03T09:44:37","modified_gmt":"2024-12-03T01:44:37","slug":"webpack%e5%b7%b2%e5%ae%89%e8%a3%85%e4%bd%86%e6%97%a0%e6%b3%95%e4%bd%bf%e7%94%a8%ef%bc%9f%e5%a6%82%e4%bd%95%e6%ad%a3%e7%a1%ae%e9%85%8d%e7%bd%ae%e5%92%8c%e5%90%af%e5%8a%a8webpack%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53134\/","title":{"rendered":"Webpack\u5df2\u5b89\u88c5\u4f46\u65e0\u6cd5\u4f7f\u7528\uff1f\u5982\u4f55\u6b63\u786e\u914d\u7f6e\u548c\u542f\u52a8Webpack\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Webpack\u5df2\u5b89\u88c5\u4f46\u65e0\u6cd5\u4f7f\u7528\uff1f\u5982\u4f55\u6b63\u786e\u914d\u7f6e\u548c\u542f\u52a8Webpack\uff1f<\/h1>\n<p>IT\u884c\u4e1a\u76f8\u5bf9\u4e8e\u4e00\u822c\u4f20\u7edf\u884c\u4e1a\uff0c\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u66f4\u5feb\uff0c\u4e00\u65e6\u505c\u6b62\u4e86\u5b66\u4e60\uff0c\u5f88\u5feb\u5c31\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u6240\u4ee5\u6211\u4eec\u9700\u8981\u8e0f\u8e0f\u5b9e\u5b9e\u7684\u4e0d\u65ad\u5b66\u4e60\uff0c\u7cbe\u8fdb\u81ea\u5df1\u7684\u6280\u672f\uff0c\u5c24\u5176\u662f\u521d\u5b66\u8005\u3002\u4eca\u5929\u7c73\u4e91\u7ed9\u5927\u5bb6\u6574\u7406\u4e86\u300aWebpack\u5df2\u5b89\u88c5\u4f46\u65e0\u6cd5\u4f7f\u7528\uff1f\u5982\u4f55\u6b63\u786e\u914d\u7f6e\u548c\u542f\u52a8Webpack\uff1f\u300b\uff0c\u804a\u804a\uff0c\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5427\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241127\/173268023967469a2f3083c.jpg\" class=\"aligncenter\" title=\"Webpack\u5df2\u5b89\u88c5\u4f46\u65e0\u6cd5\u4f7f\u7528\uff1f\u5982\u4f55\u6b63\u786e\u914d\u7f6e\u548c\u542f\u52a8Webpack\uff1f\u63d2\u56fe\" alt=\"Webpack\u5df2\u5b89\u88c5\u4f46\u65e0\u6cd5\u4f7f\u7528\uff1f\u5982\u4f55\u6b63\u786e\u914d\u7f6e\u548c\u542f\u52a8Webpack\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4f7f\u7528\u5df2\u5b89\u88c5\u7684 webpack<\/strong><\/p>\n<p>\u5df2\u5b89\u88c5\u4e86 webpack \u7ec4\u4ef6\uff0c\u4f46\u8fd8\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\uff1f\u4ee5\u4e0b\u63d0\u4f9b\u4f7f\u7528 webpack \u7684\u6b65\u9aa4\uff1a<\/p>\n<p><strong>\u4f7f\u7528\u6846\u67b6\u5f00\u53d1<\/strong><\/p>\n<p>\u6309\u7167\u9879\u76ee readme \u7684\u8bf4\u660e\u8fdb\u884c\u5373\u53ef\uff0c\u65e0\u9700\u989d\u5916\u914d\u7f6e webpack\u3002\u8fd9\u4e5f\u662f\u4f7f\u7528\u6846\u67b6\u7684\u4f18\u52bf\u6240\u5728\u3002<\/p>\n<p><strong>\u624b\u52a8\u4fee\u6539\u914d\u7f6e<\/strong><\/p>\n<p>\u82e5\u9700\u5f3a\u884c\u4fee\u6539 webpack \u914d\u7f6e\uff0c\u53ef\u5728 package.json \u4e2d\u627e\u5230\u7ebf\u7d22\uff1a<\/p>\n<pre>{\n  \"...\",\n  \"script\": {\n    \"...\",\n    \"start\": \"ts-node .\/.erb\/scripts\/check-port-in-use.js &amp;&amp;&amp; npm run start:renderer\",\n    \"start:renderer\": \"cross-env node_env=development ts_node_transpile_only=true webpack serve --config .\/.erb\/configs\/webpack.config.renderer.dev.ts\",\n  }\n}<\/pre>\n<p>\u542f\u52a8 npm run start \u65f6\u4f1a\u6267\u884c npm run start:renderer\uff0c\u5176\u4e2d\u6307\u5b9a\u4e86 .\/.erb\/configs\/webpack.config.renderer.dev.ts \u4f5c\u4e3a webpack \u914d\u7f6e\u6587\u4ef6\u3002\u901a\u8fc7\u4fee\u6539\u6b64\u6587\u4ef6\u53ef\u4ee5\u5bf9 webpack \u914d\u7f6e\u8fdb\u884c\u8c03\u6574\u3002<\/p>\n<p><strong>\u53c2\u8003\u9879\u76ee readme<\/strong><\/p>\n<p>\u4ee5\u4e0b\u662f\u9879\u76ee readme \u7684\u90e8\u5206\u6458\u5f55\u4f9b\u53c2\u8003\uff1a<\/p>\n<p><strong>\u5b89\u88c5<\/strong><\/p>\n<pre>git clone --depth 1 --branch main https:\/\/github.com\/electron-react-boilerplate\/electron-react-boilerplate.git your-project-name\ncd your-project-name\nnpm install<\/pre>\n<p><strong>\u5f00\u53d1<\/strong><\/p>\n<pre>npm start<\/pre>\n<p><strong>\u6253\u5305\u751f\u4ea7\u7248\u672c<\/strong><\/p>\n<pre>npm run package<\/pre>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300aWebpack\u5df2\u5b89\u88c5\u4f46\u65e0\u6cd5\u4f7f\u7528\uff1f\u5982\u4f55\u6b63\u786e\u914d\u7f6e\u548c\u542f\u52a8Webpack\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u5982\u4f55\u4e3a\u7b7e\u540d\u9762\u677f\u6dfb\u52a0\u6a2a\u5c4f\u63d0\u793a\u80cc\u666f\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Webpack\u5df2\u5b89\u88c5\u4f46\u65e0\u6cd5\u4f7f\u7528\uff1f\u5982\u4f55\u6b63\u786e\u914d\u7f6e\u548c\u542f\u52a8Webpack\uff1f IT\u884c\u4e1a\u76f8\u5bf9\u4e8e\u4e00\u822c\u4f20\u7edf\u884c\u4e1a\uff0c\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u66f4\u5feb\uff0c\u4e00\u65e6\u505c\u6b62\u4e86\u5b66\u4e60\uff0c\u5f88\u5feb\u5c31\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u6240\u4ee5\u6211\u4eec\u9700\u8981\u8e0f\u8e0f\u5b9e\u5b9e\u7684\u4e0d\u65ad\u5b66\u4e60\uff0c\u7cbe\u8fdb\u81ea\u5df1\u7684\u6280\u672f\uff0c\u5c24\u5176\u662f\u521d\u5b66\u8005\u3002\u4eca\u5929\u7c73\u4e91\u7ed9\u5927\u5bb6\u6574\u7406\u4e86\u300aWebpack\u5df2\u5b89\u88c5\u4f46\u65e0\u6cd5\u4f7f\u7528\uff1f\u5982\u4f55\u6b63\u786e\u914d\u7f6e\u548c\u542f\u52a8Webpack\uff1f\u300b\uff0c\u804a\u804a\uff0c\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5427\uff01 \u4f7f\u7528\u5df2\u5b89\u88c5\u7684 webpack \u5df2\u5b89\u88c5\u4e86 webpack \u7ec4\u4ef6\uff0c\u4f46\u8fd8\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\uff1f\u4ee5\u4e0b\u63d0\u4f9b\u4f7f\u7528 webpack \u7684\u6b65\u9aa4\uff1a \u4f7f\u7528\u6846\u67b6\u5f00\u53d1 \u6309\u7167\u9879\u76ee readme \u7684\u8bf4\u660e\u8fdb\u884c\u5373\u53ef\uff0c\u65e0\u9700\u989d\u5916\u914d\u7f6e webpack\u3002\u8fd9\u4e5f\u662f\u4f7f\u7528\u6846\u67b6\u7684\u4f18\u52bf\u6240\u5728\u3002 \u624b\u52a8\u4fee\u6539\u914d\u7f6e \u82e5\u9700\u5f3a\u884c\u4fee\u6539 webpack \u914d\u7f6e\uff0c\u53ef\u5728 package.json \u4e2d\u627e\u5230\u7ebf\u7d22\uff1a { &#8220;&#8230;&#8221;, &#8220;script&#8221;: { &#8220;&#8230;&#8221;, &#8220;start&#8221;: &#8220;ts-node .\/.erb\/scripts\/check-port-in-use.js &amp;&amp;&amp; npm run start:renderer&#8221;, &#8220;start:renderer&#8221;: &#8220;cross-env node_env=development ts_node_transpile_only=true webpack serve &#8211;config .\/.erb\/configs\/webpack.config.renderer.dev.ts&#8221;, } } \u542f\u52a8 npm run start \u65f6\u4f1a\u6267\u884c npm run start:renderer\uff0c\u5176\u4e2d\u6307\u5b9a\u4e86 .\/.erb\/configs\/webpack.config.renderer.dev.ts \u4f5c\u4e3a webpack \u914d\u7f6e\u6587\u4ef6\u3002\u901a\u8fc7\u4fee\u6539\u6b64\u6587\u4ef6\u53ef\u4ee5\u5bf9 webpack [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53134","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53134"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53134\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}