Ember-cli在Windows上使用ember server
构建得非常慢。
Build successful - 13126ms.
Slowest Trees | Total
-------------------------------+----------------
TreeMerger (vendor) | 3154ms
TreeMerger (stylesAndVendor) | 2051ms
TreeMerger (appAndDependencies) | 1914ms
StaticCompiler | 1791ms
这与在linux盒子上不到1秒的同一项目构建形成鲜明对比。
答案 0 :(得分:32)
有两个罪魁祸首:
在构建期间,在ember项目的./tmp
文件夹中生成大量文件,索引器和实时保护对每个文件进行额外读取,这会增加大量额外的文件I / O操作。
修复方法是:
node.exe
and/or the ./tmp
folder from realtime-protection和这应该让你的构建时间缩短到几秒钟。对于Broccoli处理构建过程,Windows的其他速度改进是 being investigated continuing to be investigated。
拥有lots of files in the bower_components is the biggest culprit。
我写了一个脚本clean-ember-cli.js,删除了除了ember-cli dependancies之外的所有内容,以及Brocfile.js
中导入的所有内容。我回到大约5秒的构建时间。
Reports are以管理员身份运行控制台也有帮助。
答案 1 :(得分:15)
Official recommendation以提高其在Windows上的性能
使用以下命令
在节点上安装ember-cli-windows npm install -g ember-cli-windows
在项目根文件夹
上运行以下命令 ember-cli-windows
答案 2 :(得分:2)
介意一件重要的事情......我在任何论坛都没有发现......如果你正在使用笔记本电脑并且你没有连接AC,那么Windows可能会以低性能模式运行以保持电量。这导致ember build proyects慢4倍
答案 3 :(得分:1)
使用ember-cli 1.13.13以及以管理员身份运行的命令提示符为我修复
答案 4 :(得分:1)
除了上面提供的答案
ember s
管理模式下的powershell中的。这将启用在Windows中默认未启用的符号链接。使用符号链接可创建更平坦的node_modules文件夹,从而缩短运行时间。
(Source)
答案 5 :(得分:1)
从 build 20262 开始,Windows 10 有 WSL 2。 这是您机器上的 Linux,它为我们提供了与 在 Linux 上。
从 Microsoft 商店获取最后一个 Ubuntu。
由于速度慢,请勿使用 /mnt/
文件夹进行 repo,
使用 ~
文件夹。
在 Ubuntu 上连接终端并克隆您的存储库。
cd ~
git clone your-repo
安装 node version manager 和 node
安装 ember-cli 并启动服务器。
npm install -g ember-cli
cd ~/your-repo
npm i
ember serve
在 VSCode 安装插件 "Remote - WSL" 中,open 您的存储库并开始开发。
答案 6 :(得分:-1)