{"id":44733,"date":"2025-08-29T15:39:44","date_gmt":"2025-08-29T07:39:44","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/?p=44733"},"modified":"2025-08-29T15:39:44","modified_gmt":"2025-08-29T07:39:44","slug":"%e5%89%8d%e7%ab%af%e6%89%93%e5%8c%85exe%e6%96%87%e4%bb%b6%e6%93%8d%e4%bd%9c%e6%ad%a5%e9%aa%a4%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2025\/ruanjiankf\/44733\/","title":{"rendered":"\u524d\u7aef\u6253\u5305exe\u6587\u4ef6\u64cd\u4f5c\u6b65\u9aa4\u4ecb\u7ecd"},"content":{"rendered":"<p>\u524d\u7aef\u6253\u5305exe\u6587\u4ef6\u662f\u6307\u5c06\u524d\u7aef\u4ee3\u7801\u901a\u8fc7\u6253\u5305\u5de5\u5177\u6253\u5305\u6210exe\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u8be5\u6587\u4ef6\uff0c\u800c\u65e0\u9700\u5b89\u88c5\u5176\u4ed6\u73af\u5883\u548c\u4f9d\u8d56\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u6253\u5305exe\u6587\u4ef6\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u524d\u7aef\u4ee3\u7801\u90e8\u7f72\u5230\u5ba2\u6237\u7aef\uff0c\u540c\u65f6\u4e5f\u4fdd\u62a4\u4e86\u6e90\u4ee3\u7801\u7684\u5b89\u5168\u6027\u3002<\/p>\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u524d\u7aef\u4ee3\u7801\u662f\u7531HTML\u3001CSS\u548cJavaScript\u7b49\u6587\u4ef6\u7ec4\u6210\u7684\u3002\u5728\u6253\u5305exe\u6587\u4ef6\u4e4b\u524d\uff0c\u9700\u8981\u5148\u5c06\u8fd9\u4e9b\u6587\u4ef6\u8fdb\u884c\u6253\u5305\u548c\u538b\u7f29\uff0c\u4ee5\u51cf\u5c0f\u6587\u4ef6\u4f53\u79ef\u548c\u63d0\u9ad8\u52a0\u8f7d\u901f\u5ea6\u3002\u5e38\u7528\u7684\u524d\u7aef\u6253\u5305\u5de5\u5177\u6709Webpack\u3001Rollup\u3001Browserify\u7b49\uff0c\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5c06\u591a\u4e2a\u6587\u4ef6\u5408\u5e76\u6210\u4e00\u4e2a\u6587\u4ef6\uff0c\u5e76\u4e14\u53ef\u4ee5\u901a\u8fc7\u5404\u79cd\u63d2\u4ef6\u6765\u8fdb\u884c\u4ee3\u7801\u538b\u7f29\u3001\u6df7\u6dc6\u7b49\u64cd\u4f5c\u3002<\/p>\n<p>\u4e0b\u9762\u4ee5Webpack\u4e3a\u4f8b\uff0c\u4ecb\u7ecd\u524d\u7aef\u6253\u5305exe\u6587\u4ef6\u7684\u5177\u4f53\u6b65\u9aa4\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff0c\u5b89\u88c5Webpack\u53ca\u76f8\u5173\u63d2\u4ef6\u3002\u53ef\u4ee5\u901a\u8fc7npm\u547d\u4ee4\u5b89\u88c5Webpack\u548c\u5176\u4ed6\u76f8\u5173\u63d2\u4ef6\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npm install webpack webpack-cli html-<a href=\"https:\/\/exe.yimenapp.com\/tool-3912.html\">exe\u751f\u6210\u8f6f\u4ef6<\/a>webpack-plugin &#8211;save-dev<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0cwebpack\u662fWebpack\u7684\u6838\u5fc3\u6a21\u5757\uff0cwebpack-cli\u662fWebpack\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0chtml-webpack-plugin\u662f\u4e00\u4e2aWebpack\u63d2\u4ef6\uff0c\u7528\u4e8e\u751f\u6210HTML\u6587\u4ef6\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff0c\u521b\u5efaWebpack\u914d\u7f6e\u6587\u4ef6\u3002\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efawebpack.config.js\u6587\u4ef6\uff0c\u914d\u7f6eWebpack\u7684\u5165\u53e3\u6587\u4ef6\u3001\u8f93\u51fa\u6587\u4ef6\u3001\u63d2\u4ef6\u7b49\u4fe1\u606f\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>const path = require(&#8216;path&#8217;);<\/p>\n<p>const HtmlWebpackPlugin = require(&#8216;html-webpack-plugin&#8217;);<\/p>\n<p>module.exports = {<\/p>\n<p>  entry: &#8216;.\/src\/index.js&#8217;,<\/p>\n<p>  output: {<\/p>\n<p>    path: path.resolve(__dirname, &#8216;dist&#8217;),<\/p>\n<p>    filename: &#8216;bundle.js&#8217;<\/p>\n<p>  },<\/p>\n<p>  plugins: [<\/p>\n<p>    new HtmlWebpackPlugin({<\/p>\n<p>      template: &#8216;.\/src\/index.html&#8217;,<\/p>\n<p>      filename: &#8216;index.html&#8217;<\/p>\n<p>    })<\/p>\n<p>  ]<\/p>\n<p>};<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0centry\u8868\u793aWebpack\u7684\u5165\u53e3\u6587\u4ef6\uff0coutput\u8868\u793aWebpack\u7684\u8f93\u51fa\u6587\u4ef6\uff0cplugins\u8868\u793aWebpack\u7684\u63d2\u4ef6\u3002<\/p>\n<p>\u7b2c\u4e09\u6b65\uff0c\u6253\u5305\u524d\u7aef\u4ee3\u7801\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884cWebpack\u547d\u4ee4\uff0c\u5c06\u524d\u7aef\u4ee3\u7801\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npx webpack &#8211;mode production<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0c&#8211;mode production\u8868\u793a\u4ee5\u751f\u4ea7\u6a21\u5f0f\u8fdb\u884c\u6253\u5305\u3002<\/p>\n<p>\u7b2c\u56db\u6b65\uff0c\u5b89\u88c5\u548c\u914d\u7f6eElectron\u3002Electron\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u7684\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\u6846\u67b6\uff0c\u53ef\u4ee5\u4f7f\u7528HTML\u3001CSS\u548cJavaScript\u7b49\u524d\u7aef\u6280\u672f\u6765\u5f00\u53d1\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002\u53ef\u4ee5\u901a\u8fc7npm\u547d\u4ee4\u5b89\u88c5Electron\u548c\u5176\u4ed6\u76f8\u5173\u63d2\u4ef6\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npm install electron electron-builder &#8211;save-dev<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0celectron\u662fElectron\u7684\u6838\u5fc3\u6a21\u5757\uff0celectron-builder\u662f\u4e00\u4e2a\u7528\u4e8e\u6784\u5efa\u548c\u6253\u5305Electron\u5e94\u7528\u7a0b\u5e8f\u7684\u63d2\u4ef6\u3002<\/p>\n<p>\u7b2c\u4e94\u6b65\uff0c\u521b\u5efaElectron\u914d\u7f6e\u6587\u4ef6\u3002\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efaelectron-builder.yml\u6587\u4ef6\uff0c\u914d\u7f6eElectron\u7684\u6253\u5305\u4fe1\u606f\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>appId: com.example.app<\/p>\n<p>productName: Example App<\/p>\n<p>directories:<\/p>\n<p>  output: dist<\/p>\n<p>  buildResources: resources<\/p>\n<p>files:<\/p>\n<p>  &#8211; dist\/**<\/p>\n<p>  &#8211; node_modules\/**<\/p>\n<p>&#8220;`<\/p>\n<p>\u5176\u4e2d\uff0cappId\u8868\u793a\u5e94\u7528\u7a0b\u5e8f\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff0cproductName\u8868\u793a\u5e94\u7528\u7a0b\u5e8f\u7684\u540d\u79f0\uff0cdirectories\u8868\u793a\u5e94\u7528\u7a0b\u5e8f\u7684\u8f93\u51fa\u76ee\u5f55\u548c\u6784\u5efa\u8d44\u6e90\u76ee\u5f55\uff0cfiles\u8868\u793a\u5e94\u7528\u7a0b\u5e8f\u7684\u6253\u5305\u6587\u4ef6\u3002<\/p>\n<p>\u7b2c\u516d\u6b65\uff0c\u6253\u5305Electron\u5e94\u7528\u7a0b\u5e8f\u3002\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884cElectron-builder\u547d\u4ee4\uff0c\u5c06\u524d\u7aef\u4ee3\u7801\u548cElectron\u6846\u67b6\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.yimenyun.net\/2023-03\/21\/16\/18864518482.jpg\" \/><\/figure>\n<\/p>\n<p>npx electron-builder<\/p>\n<p>&#8220;`<\/p>\n<p>\u6267\u884c\u5b8c\u6210\u540e\uff0c\u4f1a\u5728dist\u76ee\u5f55\u4e0b\u751f\u6210exe\u53ef\u6267\u884c\u6587\u4ef6\u548c\u5176\u4ed6\u76f8\u5173\u6587\u4ef6\u3002<\/p>\n<p>\u603b\u4e4b\uff0c\u524d\u7aef\u6253\u5305exe\u6587\u4ef6\u9700\u8981\u5148\u5c06\u524d\u7aef\u4ee3\u7801<a href=\"https:\/\/exe.yimenapp.com\/tool-3092.html\">html\u7f51\u5740\u6253\u5305exe<\/a>\u8fdb\u884c\u6253\u5305\u548c\u538b\u7f29\uff0c\u7136\u540e\u4f7f\u7528Electron\u6846\u67b6\u5c06\u5176\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u524d\u7aef\u4ee3\u7801\u90e8\u7f72\u5230\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14\u4fdd\u62a4\u4e86\u6e90\u4ee3\u7801\u7684\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u7aef\u6253\u5305exe\u6587\u4ef6\u662f\u6307\u5c06\u524d\u7aef\u4ee3\u7801\u901a\u8fc7\u6253\u5305\u5de5\u5177\u6253\u5305\u6210exe\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u8be5\u6587\u4ef6\uff0c\u800c\u65e0\u9700\u5b89\u88c5\u5176\u4ed6\u73af\u5883\u548c\u4f9d\u8d56\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u6253\u5305exe\u6587\u4ef6\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u524d\u7aef\u4ee3\u7801\u90e8\u7f72\u5230\u5ba2\u6237\u7aef\uff0c\u540c\u65f6\u4e5f\u4fdd\u62a4\u4e86\u6e90<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[6997,34662,193,11,81],"topic":[],"class_list":["post-44733","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-isoexe","tag-pcexe","tag-193","tag-11","tag-81"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/44733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=44733"}],"version-history":[{"count":1,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/44733\/revisions"}],"predecessor-version":[{"id":44770,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/44733\/revisions\/44770"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=44733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=44733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=44733"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=44733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}