Webpack changing .call(this) to .call(undefined) when packing RxJs

I’m using CycleJs, which uses RxJs. The dist/rx.all.js looks like this:

;(function(undefined) {...}.call(this));

Webpack is rewriting it as this:

;(function(undefined) {...}).call(undefined);

Which causes “this” to be undefined when the function is executed, which makes stuff break because of “use strict”

Author: Fantashit

1 thought on “Webpack changing .call(this) to .call(undefined) when packing RxJs

  1. For future readers, I was using babel-loader because my stuff is ES6. It looks like that was the problem, because excluding node_modules made the issue go away.

    module.exports = {
      module:  {
        loaders: [
          {test: /\.js/, exclude: /node_modules/, loader: "babel-loader"}

Comments are closed.