I have convert AngularJS application to es6 using webpack and import/export syntax.
Everything works perfect except this keyword.
Since webpack wrap all my code during compilation into iife function (modules), the keyword this gets undefined in functions like:
.controller( …, function() {
 ...
 this.myFunc = function() {
  someFunction().then(function(data) {
   this.someVar = data;
   // this === window
  });
 });
});
In normal angular application without bundling this gets window Object.
I do not want to make a big changes except working with webpack (I have a lot of code places that have that). Is there any way to keep this to point window object in webpack?
 
     
    