Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2.0] Component blueprint imports layout module regardless of pod structure #3472

Closed
mihai-scurtu opened this issue Mar 9, 2015 · 6 comments · Fixed by #3481
Closed

[0.2.0] Component blueprint imports layout module regardless of pod structure #3472

mihai-scurtu opened this issue Mar 9, 2015 · 6 comments · Fixed by #3481

Comments

@mihai-scurtu
Copy link

Firstly, I have set "usePods": "true" in my .ember-cli file.

If I use ember generate component x-foo, it correctly generates the files in /app/pods/components/x-foo/, but the component class tries to import the layout from the "pod-less" structure.

// app/pods/components/x-foo

import Ember from 'ember';
import layout from '../templates/components/x-foo`;

export default Ember.Component.extend({
  layout: layout

  columns: {

  }
});

This, in turn, throws the error

Uncaught Error: Could not find module `<project>/pods/components/templates/components/x-foo` imported from `<project>/pods/components/x-foo/component`
@mihai-scurtu
Copy link
Author

A simple fix would be to change line 2 to import layout from './template'; if a pod structure is detected.

@rwjblue
Copy link
Member

rwjblue commented Mar 9, 2015

So this is from within an addon then? The non-addon version of the component blueprint should not be attempting to import the layout at all...

@mihai-scurtu
Copy link
Author

I don't know how I should be linking files, so if I'm doing it wrong please let me know.

It's not from within an addon. If you look in https://github.com/ember-cli/ember-cli/blob/master/blueprints/component/files/__root__/__path__/__name__.js it should add the layout key, but judging from https://github.com/ember-cli/ember-cli/blob/master/blueprints/component/index.js it should correctly identify whether the project uses pod structure.

I feel like I'm missing something.

@jankrueger
Copy link
Contributor

'locals' (https://github.com/ember-cli/ember-cli/blob/master/blueprints/component/index.js#L44) is called with options.pod == false

@trabus
Copy link
Contributor

trabus commented Mar 9, 2015

@jankrueger Let me look into this, I'll see if I can get you some info to guide how to fix.

@trabus
Copy link
Contributor

trabus commented Mar 9, 2015

@mihai-scurtu thanks for reporting this, you found a bug with usePods.
In the meantime, you can manually fix it with import layout from './template', or remove the layout import entirely, as it's technically not needed (or preferred) inside a regular project.

The layout import will be removed for in-project blueprints in a future release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants