Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3c47c31
feat: add displayName option to whitelabel user-facing output
Paul-Browne Oct 8, 2026
1c7103c
fix: declare logPrefix in the ping shared worker
Paul-Browne Oct 8, 2026
bfb75e0
refactor: keep logPrefix out of /@vite/client exports
Paul-Browne Oct 8, 2026
630e29d
Merge branch 'main' into feat/display-name
Paul-Browne Oct 8, 2026
9f801b6
Merge branch 'main' into feat/display-name
Paul-Browne Oct 8, 2026
95bd7b3
Merge branch 'main' into feat/display-name
Paul-Browne Oct 8, 2026
33046b1
Merge branch 'main' into feat/display-name
Paul-Browne Oct 8, 2026
f2aeb0f
Merge branch 'main' into feat/display-name
Paul-Browne Oct 8, 2026
8d75559
chore: publish as @paul-browne/vite
claude Oct 8, 2026
33a49c3
fix: rewrite module-runner self-import after type checks
claude Oct 8, 2026
0fb5fd8
Merge branch 'main' into feat/display-name
Paul-Browne Oct 9, 2026
3cc6fd7
Merge branch 'main' into feat/display-name
Paul-Browne Oct 13, 2026
e82e69e
Merge branch 'main' into feat/display-name
Paul-Browne Oct 14, 2026
5924ae0
Merge branch 'main' into feat/display-name
Paul-Browne Oct 15, 2026
8df8317
feat: hide plugin names and point config hints at a tool's own config
Paul-Browne Oct 17, 2026
8b3b67f
Merge branch 'feat/display-name' into release/paul-browne-vite
Paul-Browne Oct 17, 2026
0234a31
Merge remote-tracking branch 'origin/feat/display-name' into feat/dis…
Paul-Browne Oct 17, 2026
259e1bb
release: @paul-browne/vite 8.3.5
Paul-Browne Oct 17, 2026
795c863
Merge branch 'main' into feat/display-name
Paul-Browne Oct 17, 2026
f370ba0
fix: name the module when a native plugin fails to transform it
Paul-Browne Oct 17, 2026
7a122ab
Merge branch 'fix/builtin-plugin-error-id' into release/paul-browne-vite
Paul-Browne Oct 17, 2026
6abca3e
release: @paul-browne/vite 8.3.6
Paul-Browne Oct 17, 2026
3774e59
8.3.5
Paul-Browne Oct 18, 2026
4e0200c
bump version
Paul-Browne Oct 18, 2026
b7fa611
Merge branch 'main' into feat/display-name
Paul-Browne Oct 18, 2026
6eb4f82
Merge branch 'release/paul-browne-vite' into feat/display-name
Paul-Browne Oct 18, 2026
af9d366
Merge branch 'main' into feat/display-name
Paul-Browne Oct 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions docs/config/shared-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,54 @@ export default defineConfig({
})
```

## displayName

- **Type:** `string`
- **Default:** `'vite'`

The name shown in user-facing output in place of "vite". This covers the dev server and build banners, the default logger prefix (`[vite]`), and the messages the HMR client logs to the browser console. It is meant for tools built on top of Vite that want their own name in the output.

Setting it also leaves the names of Vite's own plugins (such as `vite:css`) out of error messages, warnings and the error overlay; see [`hiddenPluginNames`](#hiddenpluginnames). It does not rename plugins, or change [`envPrefix`](#envprefix) or internal URLs such as `/@vite/client`. When using [`customLogger`](#customlogger), pass the same name to `createLogger(level, { displayName })` to keep the prefix consistent.

```js
export default defineConfig({
displayName: 'my-tool',
})
```

## hiddenPluginNames

- **Type:** `(string | RegExp)[]`
- **Default:** `[]`

Plugin names to leave out of error messages, warnings and the error overlay. A string matches a name exactly; a RegExp is tested against it. When [`displayName`](#displayname) is set, the names of Vite's own plugins (`vite:*`) are left out as well.

It is meant for tools built on top of Vite whose users neither added nor configure those plugins, so their names give the user nothing to act on. The plugins keep their names; only the output leaves them out.

```js
export default defineConfig({
displayName: 'my-tool',
hiddenPluginNames: [/^my-tool:/],
})
```

## configHint

- **Type:** `{ file: string; key?: string }`

Where users set Vite's options, for the messages that tell them to change one: the error overlay's tip and the error for a blocked host. By default these name `vite.config.js`, or the overlay the config file that was loaded.

`file` is the file users edit, and `key` the property Vite's options sit under in it, if any. It is meant for tools built on top of Vite that take Vite's options in their own config file:

```js
export default defineConfig({
displayName: 'my-tool',
// The overlay's tip says to set `vite.server.hmr.overlay` to `false`
// in `my-tool.config.js`.
configHint: { file: 'my-tool.config.js', key: 'vite' },
})
```

## clearScreen

- **Type:** `boolean`
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"picocolors": "^1.1.1",
"tsdown": "^0.23.1",
"unrun": "^0.3.1",
"vite": "workspace:*"
"vite": "workspace:@paul-browne/vite@*"
},
"compatiblePackages": {
"schemaVersion": 1,
Expand Down
31 changes: 31 additions & 0 deletions packages/vite/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# @paul-browne/vite

A fork of [Vite](https://github.com/vitejs/vite) with options for tools built on Vite that want their own name in its output ([vitejs/vite#23175](https://github.com/vitejs/vite/issues/23175), [vitejs/vite#23695](https://github.com/vitejs/vite/pull/23695)):

- `displayName` shows the tool's name instead of "vite" in CLI banners, log prefixes and the browser console, and leaves Vite's own plugin names (`vite:*`) out of errors, warnings and the error overlay.
- `hiddenPluginNames` leaves more plugin names out the same way, such as the tool's own.
- `configHint` points the error overlay's tip and the blocked-host error at the tool's config file instead of `vite.config.js`.

Each release is based on an upstream Vite release, with the patch number raised for the fork's own changes: 8.3.6 is upstream 8.3.4 plus `hiddenPluginNames`, `configHint`, and a fix that names the file when one of Rolldown's native plugins, such as the JSON plugin, fails to transform it.

Install it under the `vite` name so plugins and `import ... from 'vite'` keep working:

```sh
npm i -D vite@npm:@paul-browne/vite
```

```js
// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
displayName: 'my-tool',
hiddenPluginNames: [/^my-tool:/],
configHint: { file: 'my-tool.config.js', key: 'vite' },
})
```

The original Vite README follows.

---

# Vite ⚡

> Next Generation Frontend Tooling
Expand Down
13 changes: 8 additions & 5 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vite",
"version": "8.3.4",
"description": "Native-ESM powered web dev build tool",
"name": "@paul-browne/vite",
"version": "8.3.6",
"description": "Vite with a configurable displayName for whitelabelling (fork of vite)",
"keywords": [
"build-tool",
"dev-server",
Expand All @@ -12,13 +12,13 @@
],
"homepage": "https://vite.dev",
"bugs": {
"url": "https://github.com/vitejs/vite/issues"
"url": "https://github.com/Paul-Browne/vite/issues"
},
"license": "MIT",
"author": "Evan You",
"repository": {
"type": "git",
"url": "git+https://github.com/vitejs/vite.git",
"url": "git+https://github.com/Paul-Browne/vite.git",
"directory": "packages/vite"
},
"funding": "https://github.com/vitejs/vite?sponsor=1",
Expand Down Expand Up @@ -133,6 +133,9 @@
"ufo": "^1.6.4",
"ws": "^8.22.0"
},
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"@types/node": "^20.19.0 || >=22.12.0",
"@vitejs/devtools": "^0.7.1 || ^0.8.0",
Expand Down
27 changes: 27 additions & 0 deletions packages/vite/rewriteSelfImportsPlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Plugin } from 'rolldown'
import pkg from './package.json' with { type: 'json' }

/**
* The bundles import `vite/module-runner` from this same package. When it is
* published under another name (e.g. `@paul-browne/vite`), point those imports
* at that name so they self-resolve instead of reaching an unrelated `vite`.
* Runs last so the type bundle's own checks still see `vite/module-runner`.
*/
export function rewriteSelfImportsPlugin(): Plugin {
return {
name: 'rewrite-self-imports',
generateBundle: {
order: 'post',
handler(_opts, bundle) {
if (pkg.name === 'vite') return
for (const chunk of Object.values(bundle)) {
if (chunk.type !== 'chunk') continue
chunk.code = chunk.code.replace(
/(["'])vite\/module-runner\1/g,
`$1${pkg.name}/module-runner$1`,
)
}
},
},
}
}
2 changes: 2 additions & 0 deletions packages/vite/rolldown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import MagicString from 'magic-string'
import type { Plugin } from 'rolldown'
import { defineConfig } from 'rolldown'
import pkg from './package.json' with { type: 'json' }
import { rewriteSelfImportsPlugin } from './rewriteSelfImportsPlugin'
import licensePlugin from './rollupLicensePlugin'

// eslint-disable-next-line n/no-unsupported-features/node-builtins
Expand Down Expand Up @@ -140,6 +141,7 @@ const nodeConfig = defineConfig({
writeTypesPlugin(),
enableSourceMapsInWatchModePlugin(),
externalizeDepsInWatchPlugin(),
rewriteSelfImportsPlugin(),
],
})

Expand Down
2 changes: 2 additions & 0 deletions packages/vite/rolldown.dts.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { dts } from 'rolldown-plugin-dts'
import { parseAst } from 'rolldown/parseAst'
import type { ESTree } from 'rolldown/utils'
import pkg from './package.json' with { type: 'json' }
import { rewriteSelfImportsPlugin } from './rewriteSelfImportsPlugin'

type Directive = ESTree.Directive
type ModuleExportName = ESTree.ModuleExportName
Expand Down Expand Up @@ -59,6 +60,7 @@ export default defineConfig({
},
emitDtsOnly: true,
}),
rewriteSelfImportsPlugin(),
],
})

Expand Down
5 changes: 3 additions & 2 deletions packages/vite/src/client/bundledDevClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
registerBundledDevClient,
transport,
} from './client'
import { logPrefix } from './logPrefix'

declare const __HMR_PARTIAL_ACCEPT__: boolean

Expand Down Expand Up @@ -50,8 +51,8 @@ if (typeof DevRuntime !== 'undefined') {

const bundledDevHmrClient = new BundledDevHMRClient(
{
error: (err) => console.error('[vite]', err),
debug: (...msg) => console.debug('[vite]', ...msg),
error: (err) => console.error(logPrefix, err),
debug: (...msg) => console.debug(logPrefix, ...msg),
},
transport,
runtime,
Expand Down
34 changes: 19 additions & 15 deletions packages/vite/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '../shared/moduleRunnerTransport'
import { wrapId } from '../shared/utils'
import type { BundledDevHMRClient } from './bundledDevHmrClient'
import { logPrefix } from './logPrefix'
import { ErrorOverlay, cspNonce, overlayId } from './overlay'
// @ts-expect-error internal virtual module
import '@vite/env'
Expand All @@ -25,8 +26,7 @@ declare const __HMR_TIMEOUT__: number
declare const __HMR_ENABLE_OVERLAY__: boolean
declare const __WS_TOKEN__: string
declare const __SERVER_FORWARD_CONSOLE__: any

console.debug('[vite] connecting...')
console.debug(`${logPrefix} connecting...`)

const importMetaUrl = new URL(import.meta.url)

Expand Down Expand Up @@ -73,7 +73,7 @@ export const transport = normalizeModuleRunnerTransport(
try {
await wsTransport.connect(handlers)
console.info(
'[vite] Direct websocket connection fallback. Check out https://vite.dev/config/server-options.html#server-hmr to remove the previous connection error.',
`${logPrefix} Direct websocket connection fallback. Check out https://vite.dev/config/server-options.html#server-hmr to remove the previous connection error.`,
)
} catch (e) {
if (
Expand All @@ -85,7 +85,7 @@ export const transport = normalizeModuleRunnerTransport(
currentScriptHostURL.host +
currentScriptHostURL.pathname.replace(/@vite\/client$/, '')
console.error(
'[vite] failed to connect to websocket.\n' +
`${logPrefix} failed to connect to websocket.\n` +
'your current setup:\n' +
` (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)\n` +
` (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)\n` +
Expand All @@ -95,7 +95,7 @@ export const transport = normalizeModuleRunnerTransport(
}
return
}
console.error(`[vite] failed to connect to websocket (${e}). `)
console.error(`${logPrefix} failed to connect to websocket (${e}). `)
throw e
}
},
Expand Down Expand Up @@ -146,8 +146,8 @@ function wrapIdIfNeeded(id: string): string {

const hmrClient = new HMRClient(
{
error: (err) => console.error('[vite]', err),
debug: (...msg) => console.debug('[vite]', ...msg),
error: (err) => console.error(logPrefix, err),
debug: (...msg) => console.debug(logPrefix, ...msg),
},
transport,
async function importUpdatedModule({
Expand Down Expand Up @@ -210,7 +210,7 @@ async function handleMessage(payload: HotPayload) {
const activeHmrClient = bundledDevClient ?? hmrClient
switch (payload.type) {
case 'connected':
console.debug(`[vite] connected.`)
console.debug(`${logPrefix} connected.`)
break
case 'bundled-dev-update':
bundledDevClient!.handlePush(payload)
Expand Down Expand Up @@ -258,7 +258,7 @@ async function handleMessage(payload: HotPayload) {
newLinkTag.href = new URL(newPath, el.href).href
const removeOldEl = () => {
el.remove()
console.debug(`[vite] css hot updated: ${searchUrl}`)
console.debug(`${logPrefix} css hot updated: ${searchUrl}`)
resolve()
}
newLinkTag.addEventListener('load', removeOldEl)
Expand All @@ -274,7 +274,9 @@ async function handleMessage(payload: HotPayload) {
await activeHmrClient.notifyListeners(payload.event, payload.data)
if (payload.event === 'vite:ws:disconnect') {
if (hasDocument && !willUnload) {
console.log(`[vite] server connection lost. Polling for restart...`)
console.log(
`${logPrefix} server connection lost. Polling for restart...`,
)
const socket = payload.data.webSocket as WebSocket
const url = new URL(socket.url)
url.search = '' // remove query string including `token`
Expand Down Expand Up @@ -325,7 +327,7 @@ async function handleMessage(payload: HotPayload) {
createErrorOverlay(err)
} else {
console.error(
`[vite] Internal Server Error\n${err.message}\n${err.stack}`,
`${logPrefix} Internal Server Error\n${err.message}\n${err.stack}`,
)
}
}
Expand Down Expand Up @@ -382,6 +384,8 @@ function waitForSuccessfulPing(socketUrl: string) {
const blob = new Blob(
[
'"use strict";',
// the functions below are stringified, so module-scope values they use must be redeclared
`const logPrefix = ${JSON.stringify(logPrefix)};`,
`const waitForSuccessfulPingInternal = ${waitForSuccessfulPingInternal.toString()};`,
`const fn = ${pingWorkerContentMain.toString()};`,
`fn(${JSON.stringify(socketUrl)})`,
Expand Down Expand Up @@ -439,25 +443,25 @@ function pingWorkerContentMain(socketUrl: string) {
port.addEventListener('message', (event) => {
const { visibility } = event.data
visibilityManager.currentState = visibility
console.debug('[vite] new window visibility', visibility)
console.debug(`${logPrefix} new window visibility`, visibility)
for (const listener of visibilityManager.listeners) {
listener(visibility)
}
})
port.start()

console.debug('[vite] connected from window')
console.debug(`${logPrefix} connected from window`)
waitForSuccessfulPingInternal(socketUrl, visibilityManager).then(
() => {
console.debug('[vite] ping successful')
console.debug(`${logPrefix} ping successful`)
try {
port.postMessage({ type: 'success' })
} catch (error) {
port.postMessage({ type: 'error', error })
}
},
(error) => {
console.debug('[vite] error happened', error)
console.debug(`${logPrefix} error happened`, error)
try {
port.postMessage({ type: 'error', error })
} catch (error) {
Expand Down
4 changes: 4 additions & 0 deletions packages/vite/src/client/logPrefix.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// injected by the hmr plugin when served
declare const __DISPLAY_NAME__: string

export const logPrefix = `[${__DISPLAY_NAME__}]`
4 changes: 3 additions & 1 deletion packages/vite/src/client/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import type { ErrorPayload } from '#types/hmrPayload'
// injected by the hmr plugin when served
declare const __BASE__: string
declare const __HMR_CONFIG_NAME__: string
declare const __HMR_OVERLAY_OPTION__: string

const hmrConfigName = __HMR_CONFIG_NAME__
const hmrOverlayOption = __HMR_OVERLAY_OPTION__
const base = __BASE__ || '/'

export const cspNonce =
Expand Down Expand Up @@ -196,7 +198,7 @@ const createTemplate = () =>
' key, or fix the code to dismiss.',
h('br'),
'You can also disable this overlay by setting ',
h('code', { part: 'config-option-name' }, 'server.hmr.overlay'),
h('code', { part: 'config-option-name' }, hmrOverlayOption),
' to ',
h('code', { part: 'config-option-value' }, 'false'),
' in ',
Expand Down
Loading
Loading