Repository navigation
feat: add displayName option to whitelabel user-facing output - #23695
Open
Paul-Browne wants to merge 26 commits into
Open
Paul-Browne wants to merge 26 commits into
Paul-Browne wants to merge 26 commits into
Conversation
Closes vitejs#23175 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSCC57TQSx6pLWh7HPDg4i
The ping worker is built from stringified functions, so it cannot see module-scope values from client.ts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSCC57TQSx6pLWh7HPDg4i
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSCC57TQSx6pLWh7HPDg4i
Rename packages/vite to @paul-browne/vite (public access), point workspace references at the renamed package, and rewrite the bundles' self-import of vite/module-runner to the package's own name so it resolves whether installed as @paul-browne/vite or aliased as vite. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FeUf8NUdsphdqgGVnuUJ1A
The dts build's patch-types plugin validates that index.d.ts imports vite/module-runner in a post generateBundle hook, so rewriting the specifier in renderChunk failed the build. Rewrite in a later post generateBundle hook instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FeUf8NUdsphdqgGVnuUJ1A
Tools built on Vite still showed Vite in their error output with
`displayName` set: errors and warnings named Vite's own plugins
(`[plugin:vite:import-analysis]` in the overlay, `Plugin: vite:…` in the
terminal, `[plugin vite:…]` on build warnings), and the overlay's tip
and the blocked-host error said to edit `vite.config.js`, a file such a
tool's users may not have.
Two options for such tools:
- `hiddenPluginNames` lists plugin names (strings or RegExps) that
error messages, warnings and the overlay leave out. With
`displayName` set, Vite's own plugins (`vite:*`, `builtin:vite-*`)
are left out too. The plugins keep their names.
- `configHint: { file, key? }` says where users set Vite's options, so
the overlay's tip and the blocked-host error name that file and the
option under `key`, e.g. `vite.server.hmr.overlay` in
`my-tool.config.js`.
`buildErrorMessage` and `prepareError` take the resolved list as an
optional last argument, so existing callers are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream Vite 8.3.4 plus hiddenPluginNames and configHint. The README now says how fork releases are numbered: the upstream release they are based on, with the patch raised for the fork's own changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A JSON file that does not parse failed with `File: [object Object]`.
rolldown's wrapper for its native plugins (makeBuiltinPluginCallable)
records `args[2]` of a failed transform as the error's id, which is the
`{ moduleType, ssr, inMap }` options rather than the module at
`args[1]`. It also sets `pluginCode`, so `_formatLog` returned the error
before it filled in the id, and the old `!err.id` check would have kept
the object anyway.
`_formatLog` now fills in the active id ahead of the `pluginCode` check,
whenever the error's id is not a string.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream Vite 8.3.4 plus the fork options, and a fix for errors from Rolldown's native plugins: when one fails to transform a module, the error now names that module instead of [object Object]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23175
Tools that wrap Vite (like sitelo) still print "vite" in the dev and build banners, in [vite]-prefixed warnings and errors, and in the HMR client's browser console, even with a customLogger prefix.
This adds a displayName option (default 'vite') that replaces the name in user-facing output. createLogger(level, { displayName }) gets the same option, so the default prefix becomes [].
Covered: dev server banner (uppercased), build banner, default logger prefix, [vite future] deprecation warnings, a few [vite] server errors, and HMR client console messages (injected as DISPLAY_NAME like the other client values).
Not changed on purpose: plugin names (vite:), envPrefix (VITE_), /@vite/ URLs, the overlay element name, and sentences that name Vite as the product (Node version requirement, "removed in Vite 5", etc.).
Alternative considered: an environment variable. A config option fits better because wrappers already pass inline config to createServer/build, like logLevel and customLogger.
Tests: unit tests for the logger prefix, config default, envPrefix warning, build banner and client injection. Docs added to docs/config/shared-options.md.
AI disclosure: drafted with Claude Code. I reviewed it by reading through the code and by using this fork in a dummy consumer app with displayName: "testXYZ". I built, served, and triggered errors on purpose to check that "testXYZ" was shown instead of "vite".