Running webpack throws 'Callback was already called' error

Solution 1:

I had the same issue and I realized that I was importing CSS file from my index.html file:

<link rel="stylesheet" href="./css/main.css">

although the CSS file should have been imported from entry file (index.js) using import:

import '../css/main.css'; 

so I deleted the line <link rel="stylesheet" href="./css/main.css"> and solved the problem. You can see your HTML file and check if there are any assets imported from your HTML file. I hope it helped.

Solution 2:

tl;dr: Upgrading webpack to a newer version solved it for me.

I went into node_modules/neo-async/async.js and modified the onlyOnce so that it gives a bit more descriptive stack trace like this:

  /**
   * @private
   * @param {Function} func
   */
  function onlyOnce(func) {
    const defined = new Error('onlyOnce first used here')
    return function(err, res) {
      var fn = func;
      func = () => {
        console.error(defined);
        throwError();
      };
      fn(err, res);
    };
  }

The stack trace points into webpack’s internal code, which, when I upgraded to the latest version, solves this issue.