Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

feat(nuxi): wrap and normalize all console outputs #8846

Merged
merged 1 commit into from Nov 9, 2022
Merged

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Nov 9, 2022

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR uses consola.wrapAll instead of consola.wrapConsole in order to intercept all console outputs. Code running in SSR worker, writes to stdout and stderr instead of (main process) console object.

Now, it is possible to use something like console.log('Hello `123`') from a Vue SFC to have beautiful output formatted by console:

image

This way we can intercept console output and also improve DX for some known issues:

  • Hide 404 SSR warnings thrown by vue-router [Vue Router warn]: No match found for location with path'
  • Hide vite missing sourcemap warns originating from node_modules

It is possible to also use vite's custom logger (probably other custom loggers including one for SSR) but i assume it is easier to manage console logging and filtering from one place. We made console for Nuxt 2 with this purpose.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox
Copy link

codesandbox bot commented Nov 9, 2022

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@netlify
Copy link

netlify bot commented Nov 9, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit 2d9c206
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/636b81af83bd0e0008b01fe4

@pi0 pi0 merged commit 1496d3a into main Nov 9, 2022
@pi0 pi0 deleted the feat/nuxi-consola branch November 9, 2022 10:55
@pi0 pi0 mentioned this pull request Nov 15, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants