VSCode 源码编译
主要参考官方的配置要求https://github.com/Microsoft/vscode/wiki/How-to-Contribute
下载链接
注意点
-
由于编译打包的出的vscode是32位的,安装python和nodejs的时候最好选用32的
-
设置淘宝源
npm config set registry https://registry.npm.taobao.org
-
运行
yarn
之前设置环境变量set npm_config_arch=ia32 set npm_config_target=ia32
-
yarn install failed :vscode-ripgrep: Command failed.
有可能是 `ripgrep-0.10.0-patch.0-win32-ia32.zip`文件损坏, 删除`%Temp%\vscode-ripgrep-cache-1.2.5`目录, 重新`yarn`
-
./script/code.bat
下载依赖慢,并且总是下载失败↓ electron-v3.1.8-win32-x64.zip [--------------------] 2%
解决方法
- 使用离线下载的方法访问 http://npm.taobao.org/mirrors/electron/,选择对应的版本
- 将下载的文件放到目录
%Temp%\gulp-electron-cache\atom\electron
, 重新执行code.bat
打包
-
yarn run gulp
的各种选项都能编出不同的目标,比如vscode-win32-x64
和vscode-linux-x64-min
。 -
yarn run gulp vscode-win32-x64-archive
,打包后生成的包在.build\win32-x64\archive\VSCode-win32-x64.zip
-
yarn run gulp vscode-win32-x64-min
, 打包后生成的包在..\VSCode-win32-x64
,带 min 和不带 min 的编译方法相比,min对于其中的js文件做过体积简化。我们编译应该用带min的方式来编译。