question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Misleading error, when used with `html-webpack-plugin`

See original GitHub issue
  • Operating System: macOS 10.15.2
  • Node Version: v10.17.0
  • NPM Version: 6.11.3
  • webpack Version: webpack@4.41.5 webpack-cli@3.3.10
  • mini-css-extract-plugin Version: mini-css-extract-plugin@0.9.0

Expected Behavior

Error thrown that lead to something meaningful (still not sure what actually goes wrong)

Actual Behavior

Thrown the error in some third-party lib

% npm run build -- --mode development

> example@1.0.0 build /Users/user/foo
> webpack "--mode" "development"

/Users/user/foo/node_modules/neo-async/async.js:16
    throw new Error('Callback was already called.');
    ^

Error: Callback was already called.
    at throwError (/Users/user/foo/node_modules/neo-async/async.js:16:11)
    at /Users/user/foo/node_modules/neo-async/async.js:2818:7
    at process._tickCallback (internal/process/next_tick.js:61:11)

Code

https://gist.github.com/ogonkov/2e23941414d6f0b3d5328bd80cba5674

How Do We Reproduce?

  1. Checkout gist above
  2. npm i
  3. npm run build

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:38 (11 by maintainers)

github_iconTop GitHub Comments

17reactions
klesuncommented, Jan 9, 2020

CSS-related issues in html-webpack-plugin:

it’s probably mini-css-extract-plugin issue

Issues in mini-css-extract-plugin:

it’s probably html-webpack-plugin issue

4reactions
geonanorchcommented, Feb 18, 2020

Hit that issue as well, cost me a few hours already 😦 Thanks @ogonkov for reporting with reproducer.

@klesun a viable workaround (works for me) might be to replace MiniCssExtractPlugin by a simple file-loader :

      {
        test: /\.css$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'file-loader',
            options: {
              esModule: false,
            },
          },
          'extract-loader',
          {
            loader: 'css-loader',
            options: {
              esModule: false,
            },
          }
        ],
      },

If you also have regular JS imports then of course 2 distinct CSS rules are required.

UPDATE: just found that stackoverflow entry… 😉 Hopefully still useful to have the workaround detailed here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle loading errors & fallback with HtmlWebpackPlugin
If you use HtmlWebpackPlugin & sometimes things go wrong while your bundles are loading, we've got you covered.
Read more >
Error using partials with HTML Webpack Plugin - Stack Overflow
I'm trying to create a setup with static HTML partials using the HTML Webpack Plugin, but running into some ...
Read more >
Html-webpack-plugin NPM
If you have plugins that make use of it, html-webpack-plugin should be ... showErrors, {Boolean}, true, Errors details will be written into the...
Read more >
HTML Webpack Plugin
HTML Webpack Plugin. npm version Dependency Status bitHound Score Build status. This is a webpack plugin that simplifies creation of HTML files to...
Read more >
html-webpack-tags-plugin - npm
lets you define html tags to inject with html-webpack-plugin. ... bundle tags (should be set to false when using any script tag external...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found