ember-engines / ember-engines

Composable Ember applications for ambitious user experiences
http://ember-engines.com/
MIT License
491 stars 139 forks source link

cannot mount routable engine to my consuming app #637

Open SuperManHa opened 5 years ago

SuperManHa commented 5 years ago

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",
     ...
    },
  2. router.js this.mount('ember-blog-engine', {as: 'blog'});

  3. I add active-session.js and blog-data.js in services folder because those service is used by the demo engine.

  4. app/app.js

    engines: {
    emberBlogEngine: {
      dependencies: {
        services: [
          'blog-data',
          {'session': 'active-session'}
        ]
      }
    }
    }

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.

...
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
dknutsen commented 5 years ago

You also need to add the engine to the consuming app in app/app.js so the app knows about the engine. IMO this isn't covered very well in the guides, should probably be in the "mounting an engine" section.

SuperManHa commented 5 years ago

You also need to add the engine to the consuming app in app/app.js so the app knows about the engine. IMO this isn't covered very well in the guides, should probably be in the "mounting an engine" section.

Thanks for your reply. But I have put it in my app.js, it's my mistake that I forget this in the issue description. Have update the issue description.

villander commented 5 years ago

@SuperManHa the ember-engines 0.6.x is compatible with ember-cli 2.18 or bigger - https://github.com/ember-engines/ember-engines/blob/master/config/ember-try.js#L15

please update ember-cli on your consuming app and try again

thanks!

bertdeblock commented 3 years ago

Is this still an issue?