Coss
Coss

Reputation: 453

Minified file breaks angular

So I'm working on an older solution where we're on Angular 1.6. I decided to make it somewhat more up to date by adding using ES6. We're using grunt as a task runner so I introduced babel as a watch-task, where I add transpiled files to its own dir. After that I concatinate the files to one big file using grunt-contrib-concat, and then minify by using grunt-contrib-uglify. The concatinated file runs fine, but when minified a function from babel is hoisted and with this, breaks angular when I try to run my site.

This is added to the top of the .min.js file

"use strict";function _asyncToGenerator(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){return function o(r,i){try{var a=t[r](i),d=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(d).then(function(e){o("next",e)},function(e){o("throw",e)});e(d)}("next")})}}

In the concatinated file, this file is added at line 3700 and doesn't break execution. Anyone tips would be greatly appreciated

Edit: This is different from the problem described bellow as all angular controllers, directives, services etc are annotated correctly.

Upvotes: 1

Views: 90

Answers (0)

Related Questions