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
fix(cli): show memory usage after build for nuxt dev
#5514
Conversation
Thank you. I appreciate! |
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.
Please change it to show usage after renderer loaded resources
|
This is getting way too complicated for a simple and not precise feature anyway, but I cant get a 'render:resourcesDone' hook as proposed by @pi0 to work because I can fix it probably but then I need to change the isReady / isModernReady behaviour in renderer so they only return true when their respective |
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.
I like the idea of showing the correct memory usage in dev, thanks for the PR <3
Actually we need to wait for the renderer
to be ready (since the bundleRenderer will take some memory usage).
We need indeed to add a new hook for this, I believe together we will find a nice way to do so :)
Co-Authored-By: pi0 <pyapar@gmail.com>
Co-Authored-By: pi0 <pyapar@gmail.com>
@@ -5,7 +5,7 @@ import prettyBytes from 'pretty-bytes' | |||
export function getMemoryUsage() { | |||
// https://nodejs.org/api/process.html#process_process_memoryusage | |||
const { heapUsed, rss } = process.memoryUsage() | |||
return `Memory usage: ${chalk.bold(prettyBytes(heapUsed))} (RSS: ${prettyBytes(rss)})` | |||
return { heap: heapUsed, rss } |
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.
This is breaking banner.js
nuxt dev
Types of changes
Description
As reported by @koresar in #5509, the memory usage is printed too early for the dev command. This pr makes it optional to print memory usage in the banner and adds a simple show mem usage method for printing with consola.info
Checklist: