Ember CLI在生产中失败 [英] Ember CLI fails in production

查看:241
本文介绍了Ember CLI在生产中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过jenkins部署Ember CLI应用程序,并使用nginx进行发布。这是由jenkins构建脚本:

  npm install 
bower install
node_modules / ember-cli / bin / ember build --environment = production

nginx配置只是指示 sub。 domain.com to jenkins\jobs\lastStable\archive\dist 。这很好,但是当我去页面时,它是空白的,在控制台中输出以下输出:

  TypeError:Ember。 Handlebars.compile不是一个功能供应商 -  92ab6507ac60a5bf7c6819aa8fc418d6.js:18 
参考错误:Swag没有定义spa-client-9b01c6124f7b2a4cd2e95b62be7f5ba5.js:1

我猜这两个错误是相关的,但我无法弄明白是什么导致他们。我已经尝试这个答案似乎是一个类似的问题,但它不适用于我。一切都在我的开发环境中运行正常,而且在 Brocfile.js 中看不到任何可疑的内容。

解决方案

生产使用handlebars-runtime,不包括 Ember.Handlebars.compile 。原因是在生产中使用它更小,并且自动为您预先编译哪个ember-cli更有效。



很多关于 PR在这里找到


I am deploying an Ember CLI app through jenkins and publishing it using nginx. Here is by jenkins build script:

npm install
bower install
node_modules/ember-cli/bin/ember build --environment=production

The nginx configuration simply directs sub.domain.com to jenkins\jobs\lastStable\archive\dist. That works fine, but when I go the page, it is blank and the following output in the console:

TypeError: Ember.Handlebars.compile is not a function   vendor-92ab6507ac60a5bf7c6819aa8fc418d6.js:18
ReferenceError: Swag is not defined   spa-client-9b01c6124f5b2a4cd2e95b62be7f5ba5.js:1

I am guessing that the two errors are related, but I can't figure out what is causing them. I have tried this answer to what appears to be a similar question, but it doesn't work for me. Everything works fine in my dev environment, and I can't see anything suspicious in the Brocfile.js.

解决方案

Production uses handlebars-runtime which does not include Ember.Handlebars.compile. The reason is that it's smaller to use that in production and it's more effective to precompile which ember-cli does for you automatically.

Lots of discussion on the PR found here

这篇关于Ember CLI在生产中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆