-
Notifications
You must be signed in to change notification settings - Fork 30
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
undefined is not a function when minified #3
Comments
Also I have tried angular 1.3 beta, and angular 1.2.16 which act the same. |
Hi @zachariahtimothy, we use the minified version in several projects without issues. However, we use the minified version that comes with the package: I assume that you are minifying Is there a way for me to have a look at the actual page you are referring to so I can dig into it? Thanks! |
Sorry for the delay, had to work on something else. This is a secure internal application so no link. What is interesting is if I replace the contents of |
I'm afraid not @zachariahtimothy, I only use the standard uglify. Let me know if this causes further issues. Thanks!! |
Hello, @jvandemo. I'm having a similar problem. Here is the Gruntfile.js. Please let me know if you need any further information. Thanks. |
This should all be fixed in v2. |
+1 -- just discovered this the hard way. Using ng-min to minify all sources, and it is blowing up with
I guess I'll try to minify the |
@davisford Thanks for the report, I have reopened the issue. I will investigate it and update the code to fix it asap. Will let you know when the fix is up so you can try again. |
Thanks @jvandemo -- I am experimenting with it now to see if I can resolve it too. Will update you. This is the gulp task(s) I use to minify the production build: gulp.task('vendors-dist', function () {
var files = bowerFiles();
var vendorJs = fileTypeFilter(files, 'js');
var vendorCss = fileTypeFilter(files, 'css');
var q = new queue({objectMode: true});
if (vendorJs.length) {
q.queue(gulp.src(vendorJs).pipe(dist('js', 'vendors')));
}
if (vendorCss.length) {
q.queue(gulp.src(vendorCss).pipe(dist('css', 'vendors')));
}
return q.done();
}); This is called through: /**
* Concat, rename, minify
*
* @param {String} ext extension, e.g. 'css', 'js', etc.
* @param {String} name file name, e.g. 'vendor' || bower.name
* @param {Object} opt options for plugins
*/
function dist (ext, name, opt) {
isDistributionBuild = true;
opt = opt || {};
log('building dist for => ', ext, name, opt);
return lazypipe()
.pipe(plugins.concat, name + '.' + ext, {newLine: '\r\n'})
.pipe(gulp.dest, './dist/app')
.pipe(opt.ngmin ? plugins.ngmin : noop)
.pipe(opt.ngmin ? plugins.rename : noop, name + '.annotated.' + ext)
.pipe(opt.ngmin ? gulp.dest : noop, './dist/app')
.pipe(ext === 'js' ? plugins.uglify : plugins.minifyCss)
.pipe(plugins.rename, name + '.min.' + ext)
.pipe(gulp.dest, './dist/app')();
}
// build distribution for production
gulp.task('dist', ['clean', 'server-dist', 'jade-dist', 'vendors-dist', 'assets-dist', 'styles-dist', 'bootswatch-dist', 'scripts-dist'], function () {
return gulp.src('./src/app/index.jade')
// inject vendors.min.js, vendors.min.css into index.jade
.pipe(plugins.inject(gulp.src('./dist/app/vendors.min.{js,css}'), {ignorePath: 'dist/app', starttag: '<!-- inject:vendor:{{ext}} -->'}))
// inject our .js, .css into index.jade
.pipe(plugins.inject(gulp.src('./dist/app/' + bower.name + '.min.{js,css}'), {ignorePath: 'dist/app'}))
// write to dist/app
.pipe(gulp.dest('./dist/app'));
}); I know that's a lot to try to un-wrangle, but it has been working for me up to this point. Investigating... |
And this is the jade I have on growl-notifications
div(ng-repeat='(id, n) in notifications track by id', class='growl-container')
growl-notification(ng-class="{'success': n.type === 'success', 'warning': n.type === 'warning', 'error': n.type === 'error', 'growl': true}", ttl='n.ttl || 5000')
i.fa.fa-exclamation-triangle(ng-if="n.type === 'error'")
p {{n.msg}} |
More info, when the dist build is made, and I trigger a notification, I notice that it does not insert within the This is of course, accompanied by the errors thrown (listed above about provider) -- likely the cause of the misplacement, since the directive is responsible for placing the child elements in This is what it looks like when I run un-minified: |
SOLVED -- the issue ended up being tooling: ng-min vs. ng-annotate, refer to this thread for comparison Running both tools and comparing output: the main difference was in the directive Here is the controller: function (e, r) {
this.timer = null, thos.remove = function () { t.leave(r), this.timer && this.timer.cancel && this.timer.cancel() }
}, Here is the controller: ["$scope", "$element",
function(e, r) {
this.timer = null, this.remove = function() {
t.leave(r), this.timer && this.timer.cancel && this.timer.cancel()
}
}
], Hope this helps somebody -- I burned half a day on this one, unfortunately. |
Thank you @davisford, your efforts are much appreciated! I will update the repository tomorrow and release it as a fix. Thanks again!! |
@davisford Just released your fix as v2.0.1. Would you be able to verify if it runs correctly with your gulpfile.js before I close the issue? Thanks!! |
@davisford Just pushed some additional code changes. I would really appreciate if you could try your gulpfile with v2.1.1. It works here locally but would be great if you could verify as well. Thanks again! Much appreciated! |
This works great when running code in dev mode, but when I run grunt (ngmin, uglify, etc), I receive the following error:
undefined is not a function
.I have removed all references to growlNotifications througout my code, with the exception of my main angular module. When I remove growlNotifications from the main module, everything works fine.
If I skip ngmin and just uglify, I get
Uncaught Error: [$injector:modulerr] Failed to instantiate module choiceAdminApp due to: Error: [$injector:unpr] Unknown provider: a
I glanced at your source code and did not see any obvious offenders.
Any tips on getting growlNotifications working when ngmined and uglified?
The text was updated successfully, but these errors were encountered: