如何将可路由余烬引擎安装到我使用的应用程序上?

时间:2019-04-04 02:12:40

标签: ember.js ember-cli ember-engines

我尝试按照演示将引擎安装到我的项目中:

正在使用的应用: https://github.com/dgeb/ember-engines-demo

引擎应用程序: https://github.com/dgeb/ember-blog-engine

演示效果很好。 但是,当我将ember-blog-engine挂载到自己的使用应用程序时,会发生错误并且错误消息是 "Error: Could not find module ember-blog-engine/engine imported from (require)".

我如何添加引擎:

  1. package.json
"dependencies": {
  "ember-engines": "0.6.3",
  "ember-blog-engine": "path-to/ember-blog-engine",
   ...
},
  1. router.js
this.mount('ember-blog-engine', {as: 'blog'});
  1. 我还在服务文件夹中添加了active-session.js和blog-data.js,因为这些服务由演示引擎使用。

我发现ember-blog-engine的源代码从来没有内置到vendor.js中,当执行ember build时,控制台显示引擎处于无效模块中。 ember构建控制台的列表如下:

...
addon-tree-output/modules/ember-blog-engine/components/date-picker.js
addon-tree-output/modules/ember-blog-engine/config/environment.js
addon-tree-output/modules/ember-blog-engine/engine.js
addon-tree-output/modules/ember-blog-engine/initializers/hello.js
addon-tree-output/modules/ember-blog-engine/instance-initializers/hello-instance.js
addon-tree-output/modules/ember-blog-engine/routes.js
addon-tree-output/modules/ember-blog-engine/routes/application.js
addon-tree-output/modules/ember-blog-engine/routes/index.js
addon-tree-output/modules/ember-blog-engine/routes/new.js
addon-tree-output/modules/ember-blog-engine/routes/post.js
addon-tree-output/modules/ember-blog-engine/routes/post/comments.js
addon-tree-output/modules/ember-blog-engine/templates/application.js
addon-tree-output/modules/ember-blog-engine/templates/components/date-picker.js
addon-tree-output/modules/ember-blog-engine/templates/index.js
addon-tree-output/modules/ember-blog-engine/templates/new.js
addon-tree-output/modules/ember-blog-engine/templates/post.js
addon-tree-output/modules/ember-blog-engine/templates/post/comments.js
addon-tree-output/modules/ember-blog-engine/templates/post/index.js
...
dead 239
traversed 1347

0 个答案:

没有答案