I had some code like
require.e([], function() {
var monkey = require("./monkey");
this.setMonkey(monkey);
}.bind(this));
Since the callback isn't a function literal, webpack ends up creating a context which includes everything in the module's current directory, which isn't ideal.
I guess dealing with nonliterals in general is difficult but perhaps there could be a special case for bind? Otherwise you have to do the whole var self = this; dance. I don't have a great suggestion here (and arguably this isn't really a bug) but I wanted to file this anyway.
I had some code like
Since the callback isn't a function literal, webpack ends up creating a context which includes everything in the module's current directory, which isn't ideal.
I guess dealing with nonliterals in general is difficult but perhaps there could be a special case for
bind? Otherwise you have to do the wholevar self = this;dance. I don't have a great suggestion here (and arguably this isn't really a bug) but I wanted to file this anyway.