Skip to content

When a bound require callback is passed, webpack is unable to extract dependencies #114

@sophiebits

Description

@sophiebits

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions