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

Addon Issues #8

Closed
timkendall opened this issue Mar 4, 2016 · 3 comments
Closed

Addon Issues #8

timkendall opened this issue Mar 4, 2016 · 3 comments

Comments

@timkendall
Copy link
Contributor

I get an Cannot find module error when trying to import my styles into my component in my addon. Example:

import Ember from 'ember';
import layout from './template';
import styles from './styles';

export default Ember.Component.extend({
  layout,
  styles
});

Pod folder structure:

-addon
  -components
    -toggle-switch
      -component.js
      -styles.css
      -template.hbs

I'm not sure what is going on but it looks like styles.css is not being registered as a module in the resolver like template.hbs is.

@dfreeman
Copy link
Member

dfreeman commented Mar 5, 2016

Do you have ember-css-modules included in your dependencies for the addon?
If it's in devDependencies (which is where ember install will save it by default), then it will only compile the styles in your dummy app, and not the addon itself – it's the same reason you have to move ember-cli-htmlbars to dependencies when you ship an addon that has templates in it.

@timkendall
Copy link
Contributor Author

That fixed it! Thanks dude appreciate the quick response. I added a PR for adding that instruction to the Usage in Addons portion of the README as this a non-obvious step for new Ember devs.

@dfreeman
Copy link
Member

dfreeman commented Mar 5, 2016

Glad it worked! Thanks for updating the README – there are definitely some gotchas when you get into the murkier corners of addon dependencies

@dfreeman dfreeman closed this as completed Mar 5, 2016
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

No branches or pull requests

2 participants