Consola got RangeError because of circular structure conversion in @nuxt/typescript-build
japboy opened this issue · comments
Describe the bug
Trying to create an Nuxt module for custom consola
reporter using winston
in my Nuxt app, then I got an error below when I run yarn dev
:
error: RangeError: Maximum call stack size exceeded
at mergeObject (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:79:21)
at deepmerge (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:117:10)
at cloneUnlessOtherwiseSpecified (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:34:5)
at /path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:94:23
at Array.forEach (<anonymous>)
at mergeObject (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:86:18)
at deepmerge (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:117:10)
at cloneUnlessOtherwiseSpecified (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:34:5)
at /path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:94:23
at Array.forEach (<anonymous>)
at mergeObject (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:86:18)
at deepmerge (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:117:10)
at cloneUnlessOtherwiseSpecified (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:34:5)
at /path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:94:23
at Array.forEach (<anonymous>)
at mergeObject (/path/to/nuxt-app/node_modules/deepmerge/dist/cjs.js:86:18)","args":[]}
tl;dr It was because of fork-ts-checker-webpack-plugin
. It uses deepmerge
to merge option objects since v5.0.0 and deepmerge
doesn't support circular structure which @nuxt/typescript-build
depends.
I don't know how this should be fixed, but for now, I cannot create any custom loggers using JSON serialization.
Hopefully my English is good enough to explain the situation. Thanks.
To Reproduce
Steps to reproduce the behavior:
- Create a custom
consola
reporter Nuxt module depending onJSON.stringify
(likeconsola.JSONReporter
) - Run the Nuxt application
- See error
import consola from 'consola'
consola.setReporters([
new consola.JSONReporter(),
])
Expected behavior
RangeError
should not be occured with custom Consola Reporters.