网络编程
位置:首页>> 网络编程>> 网络编程>> Scratch3.0二次开发之windows环境下打包成exe的流程

Scratch3.0二次开发之windows环境下打包成exe的流程

作者:搁浅的执念  发布时间:2022-12-31 03:27:34 

标签:Scratch,打包,exe

先给大家看下Scratch3.0二次开发之windows环境下打包成exe的流程。

1、需要先安装npm,安装过程不作过多介绍了。

 2、直接介绍打包成exe流程。

(1)首先在scratch-gui目录下


cd scratch-gui
npm install

设置静态文件路径


set BUILD_MODE=dist
set STATIC_PATH=static

build scratch-gui


npm run build

设置链接


npm link

(2)进入scratch-desktop目录。


cd scratch-desktop
npm install

链接scratch-gui


npm link scratch-gui
npm run build-gui

生成dist文件


npm start

(3)然后打开scratch-desktop目录下的*scripts->electron-builder-wrapper.js*文件将:注释掉(49行左右)


If ((targetGroup === 'nsis') && !(childEnvironment.CSC_LINK || childEnvironment.WIN_CSC_LINK)) {
   throw new Error(NSIS build requires CSC_LINK or WIN_CSC_LINK);
}

(4)最后在刚才scratch-desktop目录下


npm run dist

完成后在scratch-desktop下的dist文件夹中即可看到scratch的安装包。

ps:下面看下Scratch3.0 源码打包配置 webpack.config.js


对打包的文件进行压缩
// 在 plugins 中添加 new UglifyJsPlugin 配置
plugins: [
new UglifyJsPlugin({
 uglifyOptions: {
  output: {
   comments: false,
  },
  warnings: false
 }
})
]

来源:https://blog.csdn.net/weixin_42061064/article/details/107080825

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com