Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consola got RangeError because of circular structure conversion in @nuxt/typescript-build #504

Closed
japboy opened this issue Apr 30, 2021 · 0 comments · Fixed by #580
Closed

Comments

@japboy
Copy link

japboy commented Apr 30, 2021

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:

  1. Create a custom consola reporter Nuxt module depending on JSON.stringify (like consola.JSONReporter)
  2. Run the Nuxt application
  3. See error
import consola from 'consola'
consola.setReporters([
  new consola.JSONReporter(),
])

Expected behavior
RangeError should not be occured with custom Consola Reporters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant