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

Materialize import breaks webpack (angular-cli) #82

Closed
Sixthdim opened this issue Aug 16, 2016 · 8 comments
Closed

Materialize import breaks webpack (angular-cli) #82

Sixthdim opened this issue Aug 16, 2016 · 8 comments

Comments

@Sixthdim
Copy link
Contributor

I'm curious as to why the materialize-css package is installed as materialize.
Here: https://github.com/InfomediaLtd/angular2-materialize/blob/master/package.json#L99

This causes an error with Webpack:

ERROR in ./~/angular2-materialize/dist/index.js                                                                                                                                                                                      
Module not found: Error: Can't resolve 'materialize' in '.../node_modules/angular2-materialize/dist'                                                                               
 @ ./~/angular2-materialize/dist/index.js 2:0-22

The only way to get this to work is to create an alias in the build process (webpack, systemjs, etc.), but this is currently not available with the latest angular-cli, and also seems a little unnecessary.

Are you able to install the materialize-css package as is, and then just import "materialize-css" here: https://github.com/InfomediaLtd/angular2-materialize/blob/master/src/index.ts#L1

Thanks!

@MarkusPint
Copy link

@rubyboy Are you accepting PR-s?

@rubyboy
Copy link
Contributor

rubyboy commented Aug 17, 2016

@Sixthdim thanks for the feedback. You can find more details in a similar issue here: #54

@MarkusPint most definitely! See my comments in #54. Maybe two deployment targets, one with and one without materialize-css, would be a good option. This way if someone wants to just import angular-materialize and let it bring all required dependencies (it does need materialize-css) they would use the current deployment. Then, create another entry point without that dependency for other people who want to bring it materialize-css any other way they want.

Thanks for offering to contribute.

@pchristou
Copy link

This is affecting me too. I'm still not clear on why this affects angular-cli webpack and not the standard seed project? Is there a workaround we can use for the moment to get around this issue?

@Sixthdim
Copy link
Contributor Author

@pchristou This mainly affects angular-cli@webpack because it doesn't (yet) support a webpack config file, so there is no way to setup an alias for "materialize" -> "materialize-css", and "materialize" doesn't exist in node_modules. The way it's setup in this project only works with JSPM. I'll see if I can get a PR up today.

@pchristou
Copy link

Thanks for the explanation @Sixthdim.

@Sixthdim
Copy link
Contributor Author

PR Created: #84

rubyboy added a commit that referenced this issue Aug 17, 2016
…d fixing Webpack and Angular CL

BREAKING CHANGE: will require previous clients to update config to use materialize-css. README needs
to be updated. #82
@rubyboy
Copy link
Contributor

rubyboy commented Aug 17, 2016

OK, PR merged and a new version has been released to npm. I haven't tested it, so please give it a whirl and I hope it will work.
Thanks @Sixthdim for picking this issue up and contributing!

@pchristou
Copy link

@rubyboy @Sixthdim Thank you both for your work. I recreated a project, imported the MaterializeDirective and that change seems to have done the trick..

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

4 participants