设置环境变量时构建错误

时间:2014-05-29 23:00:07

标签: ember-cli

运行ember build --environment staging时出现构建错误。在config / environment.js中我有一个查找staging的条件,所以我可以将baseUrl更改为我们的登台服务。但是当我尝试使用环境集进行构建时,我收到以下错误:

You must pass a file to 'EmberApp::import'. For directories specify them to the constructor under the 'trees' option.

这是ember-cli的问题还是我需要以某种方式在我的Brocfile中声明我的环境?

1 个答案:

答案 0 :(得分:1)

由于Ember目前在自定义环境方面存在问题,因此请尝试使用shell变量修改单个Ember生产环境中的行为。

如果您调用类似DEPLOY_ENV=staging ember build --environment=production的ember,那么您将能够通过DEPLOY_ENV访问所有JS文件中的process.env.DEPLOY_ENV变量并相应地修改其行为。

我个人喜欢将部署环境与应用程序环境分离,因为它允许拥有一个与生产一样的登台服务器。

相关问题