Embli-Cli建筑后不起作用

时间:2015-09-29 04:16:07

标签: ember.js ember-cli

Iam在Ember-Cli附近工作。我构建了一个项目并定制了“ember-cli-build.js”,但最终它无效。 这是我的工作步骤:
1)ember new myapp cd myapp ember server 它工作正常,我可以在“http://localhost:4200”上看到我的项目 2)然后运行ember build --environment=production并获取Built project successfully. Stored in "dist/".,这样看起来我的项目已经建成。
3)然后我在浏览器上运行这个url,直接到我的dist目录项目

localhost/~/myapp/dist/index.html

但没有任何表现。 我检查控制台,似乎“余烬”正在运行,但屏幕上没有显示

2 个答案:

答案 0 :(得分:0)

我找到了anwser。首先是关于"环境"更改这些locationType: 'hash'

APP: {
  rootElement: "#page-base"
}

然后转到&#34; project / app / index.html&#34;并放置<div id="page-base"></div>

然后按ember build --environment=production

构建项目

它工作正常。

答案 1 :(得分:0)

预计您将/dist文件夹中的所有内容部署到您的服务器,它将成为您的http服务器的根目录。并且有一种方法可以在您的本地环境中模拟此行为。您所需要的只是在系统中全局安装http-server

npm install http-server -g

然后导航到您应用的dist文件夹:

cd myapp/dist

并启动http-server:

http-server -o

那就是它。您已在本地浏览器中运行构建的ember应用程序。