mercredi 3 avril 2019

How to mount routable ember engine to my consuming app?

i try to mount an engine to my project as per the demo:

consuming app: https://github.com/dgeb/ember-engines-demo

engine app: https://github.com/dgeb/ember-blog-engine

the demo works well. But when i mount the ember-blog-engine to my own consuming app, error occurs and the error message is "Error: Could not find module ember-blog-engine/engine imported from (require)".

how i add the engine:

  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. I also add active-session.js and blog-data.js in services folder because those service is used by the demo engine.

I found the ember-blog-engine's source code is never built into vendor.js, when exec ember build, the console shows the engine is in dead module. ember build console is list as below:

...
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




Aucun commentaire:

Enregistrer un commentaire