简体   繁体   English

使用ember-cli,我应该“服务”还是“构建”?

[英]Using ember-cli, should I “serve” or “build”?

I'm on Windows 7, ember-cli version 40. Every time I make code changes I have to quit the server and restart it as I get Broccoli "ENOENT" errors for the tmp directory every time I save some changes. 我使用的是Windows 7,ember-cli版本40.每次更改代码时,我都必须退出服务器并重新启动它,因为每次保存一些更改时,tmp目录都会出现Broccoli“ENOENT”错误。

The modus operandi for the past few days has just been to Ctrl+c, then do ember server again. 过去几天的操作方式只是按Ctrl + c,然后再次执行ember server Build times are over 100 seconds. 制作时间超过100秒。 So I'm wondering if I should be doing ember build at some point, then ember server or if anyone knows why Broccoli won't rebuild automatically like it's supposed to. 所以我想知道我是否应该在某些时候进行ember build ,然后使用ember server或者如果有人知道为什么Broccoli不会像它应该的那样自动重建。 This is a small project right now, only a couple dependencies, but I just deleted over 6GB from the tmp folder because new stuff kept getting copied there. 这是一个小项目,只有几个依赖项,但我刚从tmp文件夹中删除了超过6GB,因为新的东西一直被复制到那里。

EDIT 编辑

I upgraded to ember-cli version 42, and times on Windows 7 are down to 22sec or so, which is a big improvement 我升级到ember-cli版本42,Windows 7上的时间下降到22秒左右,这是一个很大的改进

My Brocfile.js: 我的Brocfile.js:

/* global require, module */

var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var fontTree;
var app = new EmberApp();

fontTree = pickFiles('vendor/fontawesome/fonts', {
  srcDir: '/',
  files: ['*'],
  destDir: '/assets/fonts'
});
// Use `app.import` to add additional libraries to the generated
// output files.
app.import('bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js');
app.import('bower_components/moment/moment.js');

//module.exports = mergeTrees([app.toTree(), fontTree]);
module.exports = app.toTree();

100 seconds for a small project? 一个小项目100秒? You should definitely investigate the error. 你一定要调查错误。 Typically, you just run ember server , and the project rebuilds when files change. 通常,您只需运行ember server ,并在文件更改时重建项目。 Rebuilds for big projects can get upwards of 7-10 seconds, but usually that's because of a large dependency. 大型项目的重建可能会超过7-10秒,但通常是因为大的依赖性。

I would encourage you to explore the ENOENT error. 我鼓励您探索ENOENT错误。 Also, drop in #ember-cli on IRC (freenode) and ask there. 另外,将#ember-cli放在IRC(freenode)上并询问那里。

This is an issue others have reported. 这是其他人报道的问题。 There are perf problems on Windows due to Windows indexing/search. 由于Windows索引/搜索,Windows上存在性能问题。 If you disable this, you should restore much of your perf. 如果禁用此功能,则应恢复大部分性能。 Somebody else mentioned as well that it resolved this ember serve issue for them: https://github.com/stefanpenner/ember-cli/issues/1253 其他人也提到它为他们解决了这个余烬服务问题: https//github.com/stefanpenner/ember-cli/issues/1253

Some other links for you: - Slow build time in Windows Environment - Improve Windows experience 其他一些链接: - 在Windows环境中缩短构建时间 - 改善Windows体验

I just upgraded my app to ember-cli v 0.0.42, and right away saw my ember server times drop to around 20 seconds, which is still pretty slow, but much better than 180 and seems to indicate the team made some fixes that improved the Windows speed. 我刚刚将我的应用程序升级到ember-cli v 0.0.42,并立即看到我的ember server时间下降到大约20秒,这仍然很慢,但远远超过180并且似乎表明团队做了一些改进的改进Windows的速度。 I know the majority of the web dev community is on Apple machines, so I expect Windows support to lag, it's just the nature of the thing, which is ok. 我知道大多数Web开发社区都在Apple机器上,所以我希望Windows支持能够延迟,这只是事情的本质,这是好的。

In newer versions of ember-cli (0.1.0) and up, I think), if you run your "ember serve" command window as administrator, a bunch of other speedups come in because now it can use symbolic links rather than copying, and at that point build times on Windows come down to the same speed as on unix/osx. 在较新版本的ember-cli(0.1.0)及更高版本中,我认为,如果您以管理员身份运行“ember serve”命令窗口,则会出现一堆其他加速,因为现在它可以使用符号链接而不是复制,在那时,Windows上的构建时间降至与unix / osx相同的速度。 (see http://www.ember-cli.com/#symlinks-on-windows ) (见http://www.ember-cli.com/#symlinks-on-windows

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM