Skip to content

Error converting circular structure to JSON #198

@bboshoven

Description

@bboshoven
  • Webpack Version: 5.5.1
  • Operating System (or Browser): Windows 10
  • Node Version: N/A
  • Yarn Version: 1.22.5
  • webpack-plugin-serve Version: 1.2.0

How Do We Reproduce?

I know webpack 5 isn't officially supported, yet it would still work better than webpack dev server for us if this error wouldn't occur. This looks like a more generic problem which may occur now and in the future. We have a project with webpack 5+, every time I save, and while webpack is compiling you save again this error occurs. (I believe this is what I do to reproduce, but seems a bit random)

Expected Behavior

The error not to occur, check the input for circular structures before using JSON.stringify.

Actual Behavior

  TypeError: Converting circular structure to JSON
      --> starting at object with constructor 'Compiler'
      --- property 'root' closes the circle
      at JSON.stringify (<anonymous>)
      at prep (<path-to>src\node_modules\webpack-plugin-serve\lib\routes.js:14:44)
      at WebpackPluginServe.<anonymous> (<path-to>src\node_modules\webpack-plugin-serve\lib\routes.js:102:58)
      at WebpackPluginServe.emit (events.js:327:22)
      at WebpackPluginServe.emit (<path-to>src\node_modules\webpack-plugin-serve\lib\index.js:158:13)
      at <path-to>src\node_modules\webpack-plugin-serve\lib\index.js:210:35
      at Hook.eval [as callAsync] (eval at create (<path-to>src\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:74:1)
      at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<path-to>src\node_modules\webpack\node_modules\tapable\lib\Hook.js:18:14)
      at Watching._done (<path-to>src\node_modules\webpack\lib\Watching.js:183:28)
      at <path-to>src\node_modules\webpack\lib\Watching.js:108:21

The input for the JSON.stringify is: { action: 'done', data: Stats { compilation: [Compilation] }.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions