-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
feat(vue-renderer/vue-app): report SSR console logs to the browser with consola #5673
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #5673 +/- ##
=========================================
- Coverage 95.67% 95.57% -0.1%
=========================================
Files 81 81
Lines 2635 2645 +10
Branches 671 673 +2
=========================================
+ Hits 2521 2528 +7
- Misses 96 98 +2
- Partials 18 19 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES! So simple, very nicely done @atinux :)
@atinux perhaps this could be an opt-in feature? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff @atinux, well done !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think if this feature needs an extra option ? Maybe sth like: server.console: true|false|'info'|'warn'|'error'
If there is any user who is using dev mode in production or integration testing environment, this may be a risk for sensitive information leak.
About the test, I think it could be in fixture like base
, ssr
or with-config
, and verify NUXT.logs
in jsdom
or html string
I added a PR to consola to support @clarkdo I am not up to add another option for this, it's like for the loading-screen in dev. |
@atinux
|
consola updated to 2.6.1 (#5674) |
I could not find a quick way to check for logs since they are mocked in testing and catched by Jest. |
Types of changes
Description
This feature is for development mode to improve the developer experience while developing.
Problem
Switching and looking at the terminal when you want to debug your Nuxt app by doing some
console.log
can be annoying. This can disturb newcomers to universal rendering.Solution
In dev only, it copies the SSR logs to the browser and display them before mounting the Vue app.
This is how it look like when adding some logs to
examples/hello-world/pages/index.vue
:Result:
Checklist:
console.warn
when possible unjs/consola#49@clarkdo I would like your insight regarding the tests and the best place to test this feature.