Skip to content

build error or build hang with libuv 1.46 #191

@JohnKoutsoumpas

Description

@JohnKoutsoumpas
  • Operating System: Arch Linux 6.4.4-arch1-1
  • Node Version: 16.20.1
  • NPM Version: 9.8.1
  • webpack Version: 5.88.2
  • thread-loader Version: 4.0.2
  • libuv Version: 1.46

Expected Behavior

Webpack build builds successfully

Actual Behavior

Webpack build either hangs indifinetely or fails with the following 2 errors:

  1. JSON Parse failed unexpected token at random, each time, positions
  2. Error EPIPE

Code

// package.json
{
  "name": "libuv-error-webpack",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "thread-loader": "^4.0.2",
    "webpack": "^5.88.2"
  },
  "devDependencies": {
    "ts-loader": "^9.4.4",
    "typescript": "^5.1.6",
    "webpack-cli": "^5.1.4"
  }
}
// webpack.config.js
const path = require('path');

module.exports = {
  mode: "development",
  entry: './src/index.ts',
  devtool: 'inline-source-map',
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: [
          {
            loader: 'thread-loader',
          },
          {
            loader: 'ts-loader',
            options: {
              happyPackMode: true,
              experimentalWatchApi: true,
              experimentalFileCaching: true,
            }
          }
        ],
        exclude: /node_modules/,
      },
    ],
  },
  resolve: {
    extensions: ['.tsx', '.ts', '.js'],
  },
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
  },
};
// tsconfig.json
{
  "compilerOptions": {
    "outDir": "./dist/",
    "sourceMap": true,
    "noImplicitAny": true,
    "module": "commonjs",
    "target": "es5",
    "jsx": "react",
    "allowJs": true,
    "moduleResolution": "node",
  }
}
// src/index.ts
import {component1} from './test1'
import {component2} from './test2'
import {component3} from './test3'

component1()

src/test1.ts
https://gist.github.com/JohnKoutsoumpas/de5b6f893f558c13dbd5b395b349b3c1
src/test2.ts
https://gist.github.com/JohnKoutsoumpas/1f7bae8f832198a25e5dd4f28420307f
src/test3.ts
https://gist.github.com/JohnKoutsoumpas/93a20cd27063bdce1a0fc53498fc4908

How Do We Reproduce?

create all the above files in an new empty dir, run npm i and then run node ./node_modules/webpack/bin/webpack.js and it will hang indefinitely (with libuv 1.46 installed). With libuv 1.44 it builds fine.

I filed a relevant issue with libuv too, they told me that this is a problem with the application (thread-loader).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions