-
Notifications
You must be signed in to change notification settings - Fork 43
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
Minification Breaking Application #8
Comments
Finally fixed this.
Perhaps add this in the readme for anyone using it with minification? |
Minification messes with implicit dependency injection. If you're not using a build tool like ng-annotate (in your Grunt/Gulp/whatever-the-cool-kids-are-using-these-days process), you must explicitly handle dependency injection before minification for I will add a note in the readme about this, thanks. |
Cool, I wasn't aware of ng-annotate. Thanks for the advice and getting back to me. I'll close this now, cheers. |
Hey, just checking on this -- I didn't see anything in the readme and initializing ngMeta in our run block didn't solve the issue. We still get the following exception when we use minification, even with atostudios' run block suggestion: Is ng-annotate the only work around? If so it would be really helpful to list that as a requirement for anyone hoping to use ng-meta with minification. |
ng-annotate is not a dependency of this module. It's just a helper that adds explicit dependency injection exactly as in @atostudios's run block code. If this error seems to show up only while running minified code, I guess there's a function that has implicit dependencies. This is not an issue with ngMeta, but rather with all minified Angular code. For full minification support, please replace angular.config(function(ngMetaProvider, stateProvider) {
...
}) With angular.config(['ngMetaProvider', 'stateProvider', function(ngMetaProvider, stateProvider) {
...
}]) You might need to do this for controllers as well. The dependency injection Angular doc has more information. The run block in the README uses the minification-friendly code, but I will add a section for minification. Thanks. |
We actually do use explicit dependency injection everywhere in our application, in order to make it safe for minification. So, our run block starts with: and we still see the error Thanks |
I'd be able to help you better if you could show me the line that's throwing this error. |
I'll try to do some more investigation though -- maybe the way we're importing the package is incorrect or something. |
Hi @prov-alexandra - how did you resolve this issue? I am getting the same error. I'm using Any help would be much appreciated :-) |
Seems still an issue today. I minify and uglify with webpack using
Running my application renders this error at startup:
Uncompressed my app works fine and ngMeta is working properly. This is the only occurrence of ngMeta in my source code: .run((ngMeta) => {
'ngInject'
ngMeta.init()
}) Changing that to the following has no effect and the error still occurs. .run(['ngMeta', (ngMeta) => {
ngMeta.init()
}]) |
Since adding ngMeta it runs as you would expect it to but when minified it breaks throwing the following error.
Uncaught Error: [$injector:unpr] Unknown provider: eProvider <- e
I'm struggling to locate the cause. Some help would be appreciated.
Thanks!
The text was updated successfully, but these errors were encountered: