Skip to content

TypeError: Converting circular structure to JSON #162

@Nick-Hopps

Description

@Nick-Hopps
  • Operating System: win10
  • Node Version: 16.19.1
  • NPM Version: 8.19.3
  • webpack Version: 5.79.0
  • thread-loader Version: 4.0.0

Expected Behavior

Actual Behavior

\node_modules\thread-loader\dist\WorkerPool.js:95
    const messageBuffer = Buffer.from(JSON.stringify(data, _serializer.replacer), 'utf-8');
                                           ^
TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'WriteStream'
    |     property '_writableState' -> object with constructor 'WritableState'
    |     property 'afterWriteTickInfo' -> object with constructor 'Object'
    --- property 'stream' closes the circle
    at JSON.stringify (<anonymous>)

Code

// webpack.config.js
threadLoader.warmup(
  {},
  ['babel-loader', 'vue-loader']
);

// ...
{
  test: /\.js$/i,
  include: resolve('src'),
  use: ['thread-loader', 'babel-loader'],
},
{
  test: /\.vue$/i,
  include: resolve('src'),
  use: ['thread-loader', 'vue-loader'],
},
// additional code, HEY YO remove this block if you don't need it

How Do We Reproduce?

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