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

feat: show more info on server start #18808

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nozomuikuta
Copy link
Contributor

Description

Resolves #18719
Replaces #18721, whose target branch is v5

  • Deprecate DevServer.printUrls and PreviewServer.printUrls.
  • Add DevServer.printInfo and PreviewServer.printInfo
  • Make the new methods print mode and loaded .env file names on server start

Comment on lines +189 to +193
info(` ${colors.green('➜')} ${colors.bold('Mode')}: ${mode}`)
const envFiles = getLoadedEnvFileNamesForMode(mode, envDir)
info(
` ${colors.green('➜')} ${colors.bold('Env')}: ${envFiles.length ? envFiles.join(' ') : 'no env files loaded'}`,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sapphi-red says

I think it makes sense to show the mode. But for the loaded env files, I guess you can know which file is loaded if you know which mode it's running in.

#18719 (comment)


Personally, it's user-friendly to show which .env files are loaded in what order, especially for beginners and teams where both senior and junior are, even they are described in documentation.

Adding this feature doesn't seem to make Vite such slow, does it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it'll affect the perf. I felt showing the env files is a bit too wordy. Although, that's probably just because I'm too familiar with Vite 😅 I think I'm fine if the files are listed in a single line. Even further, maybe it can be in the same line with Mode?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would not print the env files. If someone is interested in knowing that (usually for debugging purposes), we could probably print it under vite:config or vite:env DEBUG flags if they're not already printed.

@bluwy
Copy link
Member

bluwy commented Nov 28, 2024

For displaying mode, maybe it could look something like this?

image

(Using bgGreen and bold). I think we should only show the mode if it's changed (not "development") as proposed in the issue, otherwise it feels like unnecessary information to me.

I also think we should prevent renaming printUrls to printInfo and breaking it if possible.

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 this pull request may close these issues.

Vite dev server screen additional infos (mode, loaded env)
3 participants