Egret Wing 版本 版本 4.1.6 (4.1.6) 在新买的机子,最新的系统上要崩溃的解决方案.
官方已经半年没有解决这个问题了.
问题是用的框架太老了.
解决方法如下:
用Visual Studio Code开发egret代码.
提示什么的都有
编码还方便,接下来讲讲怎么在vscode中断的调试代码,动作大家都会,关键是配置
0.安装插件:Debugger for Chrome
1.在项目目录下建文件夹 .vscode,注意前面有一个点
2.在.vscode目录下建json文件:tasks.json 内容如下:
{
"version": "2.0.0",
"command": "egret",
"tasks": [
{
"label": "build",
"args": [
"-sourcemap"
],
"problemMatcher": "$tsc"
},
{
"label": "clean",
"args": [
"-e"
],
"problemMatcher": "$tsc"
},
{
"label": "publish",
"args": [],
"problemMatcher": "$tsc"
}
]
}clean与publish不重要,关键得有build;在调试前build一下
3.在.vscode下建json文件launch.json:内容如下:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome",
"type": "chrome",
"request": "launch",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"preLaunchTask":"build",//这个不要的话,第二步可以不要
"port": 9222,
"userDataDir":"/Users/${env:USER}/Library/Application Support/Google/Chrome",//这个可以与chrome共享原有的插件等
"url":"http://localhost:3000/index.html?DEBUG=1",
"runtimeArgs": [
"--enable-features=AutoplayIgnoreWebAudio,WebAuthenticationCtap2"//让chrome运行时声音自动播放,不用有交互
]
}
]
}4.在终端下cd到你的工程目录下
5.运行egret run -a,
6.第五步会自动运行一个Google浏览器,你得把Google浏览器全退了.
7.在vscode中打断点.
8.按F5或直接运行,
断点工作,齐活