feat: forward browser console logs and errors to dev server terminal#20916
Conversation
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
@vitejs/plugin-legacy
vite
commit: |
|
I realized this feature has never had a proper context. This has been raised internally in voidzero as a part of AI coding improvement and I've picked up after #20487. I'll create a proper feature request to accompany with this, but the code here is self-contained and ready for review. |
|
Some thoughts:
|
Yeah or even 'forwardBrowserLogs/Console'? Would it ever not come from a browser? I think just 'error' to start would be good! Log/info could get pretty noisy - could include but default off if it's worth including? |
|
I recommend against using |
|
Thanks for the feedback! We've discussed in the meeting and I updated the description to note some tweaks which I'll do later.
My intent of "runtime" is that to contrast from Vite "plugin" side code (i.e. main Vite node process). Here "runtime" means each Vite environment including ssr and others and we could catch unhandled errors and patch console to do the same thing on ssr, which might run separately from main node process. However, the log and any errors there are usually already visible in the same console for known server environment. We'll adjust option structure and default behavior to take this into account. Also emphasizing the option as
I think we can do this with the options to selectively pick some log levels, something like https://github.com/mitsuhiko/vite-console-forward-plugin?tab=readme-ov-file#usage |
|
📝 Ran ecosystem CI on
✅ marko, ladle, unocss, sveltekit, vite-plugin-svelte, quasar, tanstack-start, vuepress, vite-plugin-react, vite-plugin-cloudflare, vitepress, vite-environment-examples, vite-setup-catalogue, vitest, vite-plugin-vue, waku, vite-plugin-rsc |
|
I experimented with enabling |
| expect( | ||
| serverLogs.slice(lastServerLogIndex).map(stripVTControlCharacters), | ||
| ).toContain('hmr update /self-accept-within-circular/c.js') |
There was a problem hiding this comment.
This was the only one failing when enabling forwardConsole by default on Vite. I adjusted it to make it more robust.
bluwy
left a comment
There was a problem hiding this comment.
Personally I'm conflicted if we should detect agents and enable by default, but not enough that I'd block the PR, just unfortunate that it has a huge license file.
Otherwise I think this is a nice feature to have and indeed we can consider enabling by default in the future.
| if (stack === nearest) { | ||
| const code = fs.readFileSync(stack.file, 'utf-8') | ||
| output += generateCodeFrame(code, stack).replace(/^/gm, ' ') | ||
| output += '\n' | ||
| } |
There was a problem hiding this comment.
TOCTOU (Time-of-Check-Time-of-Use) race condition: The file existence is checked in the find() predicate (line 116), but the file is read later without error handling. The file could be deleted between the check and read, causing an unhandled exception.
if (stack === nearest) {
try {
const code = fs.readFileSync(stack.file, 'utf-8')
output += generateCodeFrame(code, stack).replace(/^/gm, ' ')
output += '\n'
} catch {
// Skip code frame if file is no longer accessible
}
}This will crash the error formatting when files are modified/deleted during development.
| if (stack === nearest) { | |
| const code = fs.readFileSync(stack.file, 'utf-8') | |
| output += generateCodeFrame(code, stack).replace(/^/gm, ' ') | |
| output += '\n' | |
| } | |
| if (stack === nearest) { | |
| try { | |
| const code = fs.readFileSync(stack.file, 'utf-8') | |
| output += generateCodeFrame(code, stack).replace(/^/gm, ' ') | |
| output += '\n' | |
| } catch { | |
| // Skip code frame if file is no longer accessible | |
| } | |
| } |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [vite](https://vite.dev) ([source](https://github.com/vitejs/vite/tree/HEAD/packages/vite)) | [`^7.3.1` → `^8.0.0`](https://renovatebot.com/diffs/npm/vite/7.3.1/8.0.0) |  |  | --- ### Release Notes <details> <summary>vitejs/vite (vite)</summary> ### [`v8.0.0`](https://github.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#800-2026-03-12) [Compare Source](vitejs/vite@v7.3.1...v8.0.0)  Today, we're thrilled to announce the release of the next Vite major: - **[Vite 8.0 announcement blog post](https://vite.dev/blog/announcing-vite8.html)** - [Docs](https://vite.dev/) (translations: [简体中文](https://cn.vite.dev/), [日本語](https://ja.vite.dev/), [Español](https://es.vite.dev/), [Português](https://pt.vite.dev/), [한국어](https://ko.vite.dev/), [Deutsch](https://de.vite.dev/), [فارسی](https://fa.vite.dev/)) - [Migration Guide](https://vite.dev/guide/migration.html) ##### ⚠ BREAKING CHANGES - remove `import.meta.hot.accept` resolution fallback ([#​21382](vitejs/vite#21382)) - update default browser target ([#​21193](vitejs/vite#21193)) - the epic `rolldown-vite` merge ([#​21189](vitejs/vite#21189)) ##### Features - update rolldown to 1.0.0-rc.9 ([#​21813](vitejs/vite#21813)) ([f05be0e](vitejs/vite@f05be0e)) - warn when `vite-tsconfig-paths` plugin is detected ([#​21781](vitejs/vite#21781)) ([ada493e](vitejs/vite@ada493e)) - **css:** support es2025 build target for lightningcss ([#​21769](vitejs/vite#21769)) ([08906e7](vitejs/vite@08906e7)) - forward browser console logs and errors to dev server terminal ([#​20916](vitejs/vite#20916)) ([2540ed0](vitejs/vite@2540ed0)) - update rolldown to 1.0.0-rc.8 ([#​21790](vitejs/vite#21790)) ([a0c950e](vitejs/vite@a0c950e)) - export `Visitor` and `ESTree` from `rolldown/utils` ([#​21664](vitejs/vite#21664)) ([45de31e](vitejs/vite@45de31e)) - update rolldown to 1.0.0-rc.6 ([#​21714](vitejs/vite#21714)) ([37a65f8](vitejs/vite@37a65f8)) - use util.inspect for CLI error display ([#​21668](vitejs/vite#21668)) ([5f425a9](vitejs/vite@5f425a9)) - update rolldown to 1.0.0-rc.5 ([#​21660](vitejs/vite#21660)) ([b3ddbc5](vitejs/vite@b3ddbc5)) - update rolldown to 1.0.0-rc.4 ([#​21617](vitejs/vite#21617)) ([1ee5c7f](vitejs/vite@1ee5c7f)) - **wasm:** add SSR support for `.wasm?init` ([#​21102](vitejs/vite#21102)) ([216a3b5](vitejs/vite@216a3b5)) - integrate devtools ([#​21331](vitejs/vite#21331)) ([acbf507](vitejs/vite@acbf507)) - update rolldown to 1.0.0-rc.3 ([#​21554](vitejs/vite#21554)) ([43358e9](vitejs/vite@43358e9)) - **manifest:** add `assets` field for standalone CSS entry points ([#​21015](vitejs/vite#21015)) ([f289b9b](vitejs/vite@f289b9b)) - update rolldown to 1.0.0-rc.2 ([#​21512](vitejs/vite#21512)) ([fa136a9](vitejs/vite@fa136a9)) - **bundled-dev:** support worker in initial bundle ([#​21415](vitejs/vite#21415)) ([f3d3149](vitejs/vite@f3d3149)) - **dev:** detect port conflicts on wildcard hosts ([#​21381](vitejs/vite#21381)) ([b0dd5a9](vitejs/vite@b0dd5a9)) - shortcuts case insensitive ([#​21224](vitejs/vite#21224)) ([7796ade](vitejs/vite@7796ade)) - update rolldown to 1.0.0-rc.1 ([#​21463](vitejs/vite#21463)) ([ff9dd7f](vitejs/vite@ff9dd7f)) - warn if `envPrefix` contains spaces ([#​21292](vitejs/vite#21292)) ([9fcde3c](vitejs/vite@9fcde3c)) - update rolldown to 1.0.0-beta.60 ([#​21408](vitejs/vite#21408)) ([c33aa7c](vitejs/vite@c33aa7c)) - update rolldown to 1.0.0-beta.59 ([#​21374](vitejs/vite#21374)) ([0037943](vitejs/vite@0037943)) - add `ignoreOutdatedRequests` option to `optimizeDeps` ([#​21364](vitejs/vite#21364)) ([b2e75aa](vitejs/vite@b2e75aa)) - add ios to default esbuild targets ([#​21342](vitejs/vite#21342)) ([daae6e9](vitejs/vite@daae6e9)) - update rolldown to 1.0.0-beta.58 ([#​21354](vitejs/vite#21354)) ([ba40cef](vitejs/vite@ba40cef)) - update rolldown to 1.0.0-beta.57 ([#​21335](vitejs/vite#21335)) ([d5412ef](vitejs/vite@d5412ef)) - **css:** support es2024 build target for lightningcss ([#​21294](vitejs/vite#21294)) ([bd33b8e](vitejs/vite@bd33b8e)) - update rolldown to 1.0.0-beta.56 ([#​21323](vitejs/vite#21323)) ([9847a63](vitejs/vite@9847a63)) - introduce v2 native plugins and enable it by default ([#​21268](vitejs/vite#21268)) ([42f2ab3](vitejs/vite@42f2ab3)) - **ssr:** avoid errors when rewriting already rewritten stacktrace ([#​21269](vitejs/vite#21269)) ([98d9a33](vitejs/vite@98d9a33)) - update rolldown to 1.0.0-beta.55 ([#​21300](vitejs/vite#21300)) ([2c8db85](vitejs/vite@2c8db85)) - update rolldown to 1.0.0-beta.54 ([#​21267](vitejs/vite#21267)) ([c751172](vitejs/vite@c751172)) - add a warning that is output when a plugin sets esbuild related options ([#​21218](vitejs/vite#21218)) ([200646b](vitejs/vite@200646b)) - highly experimental full bundle mode ([#​21235](vitejs/vite#21235)) ([83d8c99](vitejs/vite@83d8c99)) - print esbuild options when both esbuild and oxc options are set ([#​21216](vitejs/vite#21216)) ([08ae87b](vitejs/vite@08ae87b)) - update default browser target ([#​21193](vitejs/vite#21193)) ([8c3dd06](vitejs/vite@8c3dd06)) - the epic `rolldown-vite` merge ([#​21189](vitejs/vite#21189)) ([4a7f8d4](vitejs/vite@4a7f8d4)) ##### Bug Fixes - **deps:** update all non-major dependencies ([#​21786](vitejs/vite#21786)) ([eaa4352](vitejs/vite@eaa4352)) - use `watch.watcher` instead of `watch.notify` ([#​21793](vitejs/vite#21793)) ([88953b3](vitejs/vite@88953b3)) - **css:** apply `server.origin` to public file URLs in CSS (fix [#​18457](vitejs/vite#18457)) ([#​21697](vitejs/vite#21697)) ([c967f48](vitejs/vite@c967f48)) - **deps:** update all non-major dependencies ([#​21732](vitejs/vite#21732)) ([5c921ca](vitejs/vite@5c921ca)) - **dev:** disable extglobs for consistency ([#​21745](vitejs/vite#21745)) ([1958eeb](vitejs/vite@1958eeb)) - **lib:** keep annotation comments for es output ([#​21740](vitejs/vite#21740)) ([dd3c4f4](vitejs/vite@dd3c4f4)) - **optimizer:** avoid error happening with a package with asset entrypoint ([#​21766](vitejs/vite#21766)) ([f7e1d07](vitejs/vite@f7e1d07)) - **ssr:** throw friendly error when calling `ssrLoadModule` with non-runnable ssr env ([#​21739](vitejs/vite#21739)) ([1fa736e](vitejs/vite@1fa736e)) - **types:** remove extends ImportMeta from ModuleRunnerImportMeta ([#​21710](vitejs/vite#21710)) ([0176d45](vitejs/vite@0176d45)) - **wasm:** reset assetUrlRE.lastIndex before .test() in SSR builds ([#​21780](vitejs/vite#21780)) ([3a0d8d9](vitejs/vite@3a0d8d9)) - **deps:** update all non-major dependencies ([#​21691](vitejs/vite#21691)) ([521fdc0](vitejs/vite@521fdc0)) - **optimizer:** avoid duplicate modules when `preserveSymlinks` is enabled ([#​21720](vitejs/vite#21720)) ([72165e0](vitejs/vite@72165e0)) - **dev:** only treat EADDRINUSE as port conflict in wildcard pre-check ([#​21642](vitejs/vite#21642)) ([e54e25f](vitejs/vite@e54e25f)) - **dev:** prevent concurrent server restarts ([#​21636](vitejs/vite#21636)) ([8ce23a3](vitejs/vite@8ce23a3)) - **dev:** return "502 Bad Gateway" on proxy failures instead of 500 ([#​21652](vitejs/vite#21652)) ([e240df2](vitejs/vite@e240df2)) - clear tsconfig cache only when tsconfig.json is cached ([#​21622](vitejs/vite#21622)) ([50c9675](vitejs/vite@50c9675)) - **deps:** update all non-major dependencies ([#​21594](vitejs/vite#21594)) ([becdc5d](vitejs/vite@becdc5d)) - **lib:** CSS injection point error with nested name IIFE output ([#​21606](vitejs/vite#21606)) ([5003de6](vitejs/vite@5003de6)) - **module-runner:** incorrect column with `sourcemapInterceptor: "prepareStackTrace"` ([#​21562](vitejs/vite#21562)) ([416c095](vitejs/vite@416c095)) - **module-runner:** prevent crash on negative column in stacktrace ([#​21585](vitejs/vite#21585)) ([a075590](vitejs/vite@a075590)) - rolldownOptions/rollupOptions merging at environment level ([#​21612](vitejs/vite#21612)) ([db2ecc7](vitejs/vite@db2ecc7)) - **scanner:** respect tsconfig.json ([#​21547](vitejs/vite#21547)) ([c6c04db](vitejs/vite@c6c04db)) - avoid registering customization hook for import meta resolver multiple times ([#​21518](vitejs/vite#21518)) ([8bb3203](vitejs/vite@8bb3203)) - **config:** avoid watching rolldown runtime virtual module ([#​21545](vitejs/vite#21545)) ([d18b139](vitejs/vite@d18b139)) - **deps:** update all non-major dependencies ([#​21540](vitejs/vite#21540)) ([9ebaeaa](vitejs/vite@9ebaeaa)) - populate originalFileNames when resolving CSS asset paths ([#​21542](vitejs/vite#21542)) ([8b47ff7](vitejs/vite@8b47ff7)) - **deps:** update all non-major dependencies ([#​21488](vitejs/vite#21488)) ([2b32ca2](vitejs/vite@2b32ca2)) - disable `tsconfig` option when loading config ([#​21517](vitejs/vite#21517)) ([5025c35](vitejs/vite@5025c35)) - **optimizer:** map relative `new URL` paths to correct relative file location ([#​21434](vitejs/vite#21434)) ([ca96cbc](vitejs/vite@ca96cbc)) - avoid using deprecated `output.inlineDynamicImport` option ([#​21464](vitejs/vite#21464)) ([471ce62](vitejs/vite@471ce62)) - use separate hook object for each environment ([#​21472](vitejs/vite#21472)) ([66347f6](vitejs/vite@66347f6)) - **deps:** update all non-major dependencies ([#​21440](vitejs/vite#21440)) ([1835995](vitejs/vite@1835995)) - **dev:** avoid event emitter leak caused by `server.listen` callback ([#​21451](vitejs/vite#21451)) ([602d786](vitejs/vite@602d786)) - lazy hook filter should work ([#​21443](vitejs/vite#21443)) ([bc0c207](vitejs/vite@bc0c207)) - **optimizer:** skip `rolldownCjsExternalPlugin` for `platform: neutral` ([#​21452](vitejs/vite#21452)) ([d2fc4be](vitejs/vite@d2fc4be)) - **deps:** update all non-major dependencies ([#​21389](vitejs/vite#21389)) ([30f48df](vitejs/vite@30f48df)) - **deps:** update esbuild peerDependency version ([#​21398](vitejs/vite#21398)) ([4266c97](vitejs/vite@4266c97)) - **hmr:** trigger prune event when last import is removed ([#​20781](vitejs/vite#20781)) ([#​21093](vitejs/vite#21093)) ([7576735](vitejs/vite@7576735)) - **module-runner:** use `process.getBuiltinModule` instead of `import('node:module')` ([#​21402](vitejs/vite#21402)) ([6633bcb](vitejs/vite@6633bcb)) - support .env file mounts (FIFOs) ([#​21365](vitejs/vite#21365)) ([6e6f82a](vitejs/vite@6e6f82a)) - **css:** stylus Evaluator support ([#​21376](vitejs/vite#21376)) ([cf9ace1](vitejs/vite@cf9ace1)) - **deps:** update all non-major dependencies ([#​21321](vitejs/vite#21321)) ([9bc7c2e](vitejs/vite@9bc7c2e)) - **import-analysis:** avoid cjs interop for built browser external module ([#​21333](vitejs/vite#21333)) ([dc5a2fb](vitejs/vite@dc5a2fb)) - **worker:** handle `new Worker(..., new URL(import.meta.url))` with trailing comma ([#​21325](vitejs/vite#21325)) ([4a47241](vitejs/vite@4a47241)) - detect `import.meta.resolve` when formatted across multiple lines ([#​21312](vitejs/vite#21312)) ([130e718](vitejs/vite@130e718)) - allow no-cors requests for non-script tag requests ([#​21299](vitejs/vite#21299)) ([ef3d596](vitejs/vite@ef3d596)) - **deps:** update all non-major dependencies ([#​21285](vitejs/vite#21285)) ([4635b2e](vitejs/vite@4635b2e)) - unreachable error when building with `experimental.bundledDev` is enabled ([#​21296](vitejs/vite#21296)) ([e81c183](vitejs/vite@e81c183)) - **deps:** update all non-major dependencies ([#​21231](vitejs/vite#21231)) ([859789c](vitejs/vite@859789c)) - don't strip base from imports ([#​21221](vitejs/vite#21221)) ([7da742b](vitejs/vite@7da742b)) - allow exiting process before optimizer cleanup is done ([#​21170](vitejs/vite#21170)) ([55ceffc](vitejs/vite@55ceffc)) - plugin shortcut support ([#​21211](vitejs/vite#21211)) ([6a3aca0](vitejs/vite@6a3aca0)) ##### Performance Improvements - **ssr:** skip circular import check for already-evaluated modules ([#​21632](vitejs/vite#21632)) ([235140b](vitejs/vite@235140b)) - use tsconfig cache for oxc transform in dev ([#​21643](vitejs/vite#21643)) ([57ff177](vitejs/vite@57ff177)) ##### Documentation - bulk of typo fixes ([#​21507](vitejs/vite#21507)) ([80755da](vitejs/vite@80755da)) - update `build.dynamicImportVarsOptions` ([#​21477](vitejs/vite#21477)) ([54ce2ed](vitejs/vite@54ce2ed)) - clarify the pronunciation of `vite` in IPA symbols ([#​21238](vitejs/vite#21238)) ([9b1d4d6](vitejs/vite@9b1d4d6)) - ensure https links ([#​21266](vitejs/vite#21266)) ([2eb259a](vitejs/vite@2eb259a)) ##### Miscellaneous Chores - **deps-dev:** bump rollup from 4.57.1 to 4.59.0 ([#​21717](vitejs/vite#21717)) ([25227bb](vitejs/vite@25227bb)) - **deps:** update dependency cac to v7 ([#​21788](vitejs/vite#21788)) ([44e33ae](vitejs/vite@44e33ae)) - **deps:** update dependency rolldown-plugin-dts to ^0.22.2 ([#​21731](vitejs/vite#21731)) ([d8ea652](vitejs/vite@d8ea652)) - **deps:** remove `fdir` and `@rollup/plugin-commonjs` ([#​21639](vitejs/vite#21639)) ([5abffd5](vitejs/vite@5abffd5)) - **deps:** update dependency [@​rollup/plugin-alias](https://github.com/rollup/plugin-alias) to v6 ([#​21097](vitejs/vite#21097)) ([44b5bdf](vitejs/vite@44b5bdf)) - fix broken link for future deprecations ([#​21603](vitejs/vite#21603)) ([25f4501](vitejs/vite@25f4501)) - update `customResolver` deprecation message to mention `enforce: 'pre'` ([#​21576](vitejs/vite#21576)) ([2ce34d5](vitejs/vite@2ce34d5)) - update rolldown-plugin-dts to 0.22.1 ([#​21559](vitejs/vite#21559)) ([77aab4b](vitejs/vite@77aab4b)) - **deps:** update dependency rolldown-plugin-dts to ^0.21.8 ([#​21539](vitejs/vite#21539)) ([33881cb](vitejs/vite@33881cb)) - add missing versions to changelog ([#​21515](vitejs/vite#21515)) ([4bfb239](vitejs/vite@4bfb239)) - **deps:** update rolldown-related dependencies ([#​21487](vitejs/vite#21487)) ([5863e51](vitejs/vite@5863e51)) - **deps:** update rolldown-related dependencies ([#​21390](vitejs/vite#21390)) ([be9dd4e](vitejs/vite@be9dd4e)) - fix typo in plugin.ts comment ([#​21435](vitejs/vite#21435)) ([d31fc66](vitejs/vite@d31fc66)) - replace caniuse link for ES2024 ([#​21355](vitejs/vite#21355)) ([2ba4e99](vitejs/vite@2ba4e99)) - cleanup changelog ([#​21202](vitejs/vite#21202)) ([8c8c56e](vitejs/vite@8c8c56e)) - **deps:** update rolldown-related dependencies ([#​21230](vitejs/vite#21230)) ([9349446](vitejs/vite@9349446)) - fix spelling error ([#​21223](vitejs/vite#21223)) ([cc10e20](vitejs/vite@cc10e20)) ##### Code Refactoring - don't add `optimization.inlineConst: { mode: 'smart' }` as it's enabled by default ([#​21794](vitejs/vite#21794)) ([22b3d11](vitejs/vite@22b3d11)) - enable some native plugins even with enable native plugin false ([#​21744](vitejs/vite#21744)) ([fc46c79](vitejs/vite@fc46c79)) - avoid deprecated `legalComments` option ([#​21721](vitejs/vite#21721)) ([e06496e](vitejs/vite@e06496e)) - use `ESTree` types from `rolldown/utils` ([#​21719](vitejs/vite#21719)) ([9239750](vitejs/vite@9239750)) - deprecate `customResolver` in `resolve.alias` ([#​21476](vitejs/vite#21476)) ([81275c9](vitejs/vite@81275c9)) - remove unnecessary `@rolldown/pluginutils` ([#​21560](vitejs/vite#21560)) ([c367b62](vitejs/vite@c367b62)) - enable some native plugins even with enable native plugin false ([#​21608](vitejs/vite#21608)) ([5a4f692](vitejs/vite@5a4f692)) - use `rolldown/utils` ([#​21577](vitejs/vite#21577)) ([e56103f](vitejs/vite@e56103f)) - use internal devtools config ([#​21609](vitejs/vite#21609)) ([9aea20f](vitejs/vite@9aea20f)) - use parseEnv ([#​21586](vitejs/vite#21586)) ([f859d2c](vitejs/vite@f859d2c)) - **wasm:** remove native wasm helper plugin usage ([#​21566](vitejs/vite#21566)) ([71a86be](vitejs/vite@71a86be)) - enable some native plugins even with enable native plugin false ([#​21511](vitejs/vite#21511)) ([b40292c](vitejs/vite@b40292c)) - remove `experimental.enableNativePlugin: 'resolver'` ([#​21510](vitejs/vite#21510)) ([f9d9213](vitejs/vite@f9d9213)) - use `import.meta.dirname` everywhere ([#​21509](vitejs/vite#21509)) ([7becf5f](vitejs/vite@7becf5f)) - **optimizer:** simplify `rolldownCjsExternalPlugin` ([#​21450](vitejs/vite#21450)) ([ebda8fd](vitejs/vite@ebda8fd)) - remove `import.meta.hot.accept` resolution fallback ([#​21382](vitejs/vite#21382)) ([71d0797](vitejs/vite@71d0797)) - **optimizer:** remove dead code ([#​21334](vitejs/vite#21334)) ([e9a2cdb](vitejs/vite@e9a2cdb)) ##### Tests - **ssr:** incorrect `handleInvoke` was called in server-worker-runner.invoke test ([#​21751](vitejs/vite#21751)) ([b95ca22](vitejs/vite@b95ca22)) - add more type tests for `defineConfig` ([#​21698](vitejs/vite#21698)) ([4fedbbd](vitejs/vite@4fedbbd)) - test case for catching invalid package resolution error ([#​21601](vitejs/vite#21601)) ([c9b9359](vitejs/vite@c9b9359)) - **bundled-dev:** add worker test cases ([#​21557](vitejs/vite#21557)) ([569bc98](vitejs/vite@569bc98)) ##### Beta Changelogs ##### [8.0.0-beta.18](vitejs/vite@v8.0.0-beta.17...v8.0.0-beta.18) (2026-03-09) See [8.0.0-beta.18 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.18/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.17](vitejs/vite@v8.0.0-beta.16...v8.0.0-beta.17) (2026-03-09) See [8.0.0-beta.17 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.17/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.16](vitejs/vite@v8.0.0-beta.15...v8.0.0-beta.16) (2026-02-27) See [8.0.0-beta.16 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.16/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.15](vitejs/vite@v8.0.0-beta.14...v8.0.0-beta.15) (2026-02-19) See [8.0.0-beta.15 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.15/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.14](vitejs/vite@v8.0.0-beta.13...v8.0.0-beta.14) (2026-02-12) See [8.0.0-beta.14 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.14/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.13](vitejs/vite@v8.0.0-beta.12...v8.0.0-beta.13) (2026-02-05) See [8.0.0-beta.13 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.13/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.12](vitejs/vite@v8.0.0-beta.11...v8.0.0-beta.12) (2026-02-03) See [8.0.0-beta.12 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.12/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.11](vitejs/vite@v8.0.0-beta.10...v8.0.0-beta.11) (2026-01-29) See [8.0.0-beta.11 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.11/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.10](vitejs/vite@v8.0.0-beta.9...v8.0.0-beta.10) (2026-01-24) See [8.0.0-beta.10 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.10/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.9](vitejs/vite@v8.0.0-beta.8...v8.0.0-beta.9) (2026-01-22) See [8.0.0-beta.9 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.9/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.8](vitejs/vite@v8.0.0-beta.7...v8.0.0-beta.8) (2026-01-15) See [8.0.0-beta.8 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.8/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.7](vitejs/vite@v8.0.0-beta.6...v8.0.0-beta.7) (2026-01-08) See [8.0.0-beta.7 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.7/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.6](vitejs/vite@v8.0.0-beta.5...v8.0.0-beta.6) (2026-01-07) See [8.0.0-beta.6 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.6/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.5](vitejs/vite@v8.0.0-beta.4...v8.0.0-beta.5) (2025-12-25) See [8.0.0-beta.5 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.5/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.4](vitejs/vite@v8.0.0-beta.3...v8.0.0-beta.4) (2025-12-22) See [8.0.0-beta.4 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.4/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.3](vitejs/vite@v8.0.0-beta.2...v8.0.0-beta.3) (2025-12-18) See [8.0.0-beta.3 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.3/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.2](vitejs/vite@v8.0.0-beta.1...v8.0.0-beta.2) (2025-12-12) See [8.0.0-beta.2 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.2/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.1](vitejs/vite@v8.0.0-beta.0...v8.0.0-beta.1) (2025-12-08) See [8.0.0-beta.1 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.1/packages/vite/CHANGELOG.md) ##### [8.0.0-beta.0](vitejs/vite@v7.2.4...v8.0.0-beta.0) (2025-12-03) See [8.0.0-beta.0 changelog](https://github.com/vitejs/vite/blob/v8.0.0-beta.0/packages/vite/CHANGELOG.md) ##### Rolldown-Vite changelogs See [rolldown-vite changelog](https://github.com/vitejs/rolldown-vite/blob/v7.2.10/packages/vite/CHANGELOG.md) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My42Ni41IiwidXBkYXRlZEluVmVyIjoiNDMuNzYuMiIsInRhcmdldEJyYW5jaCI6Im5leHQiLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://git.valverde.cloud/Thilawyn/effect-fc/pulls/37 Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
Description
This PR adds a browser-to-server console forwarding feature for dev server, so runtime client signals can be surfaced directly in terminal output. This is useful for development with coding agent as the server side log can be easier to be read. For example, when running playwright e2e with Vite dev server in
webServerconfig, playwright pipes stderr by default and it allows agent invoking playwright cli to see through browser side runtime errors and logs directly.Configuration
The basic shape of configuration is a following:
The default becomes true when
@vercel/detect-agentdetect it's running under coding agent. Otherwise it's false.Implementation
The implementation of forwarding and formatting are heavily based on Vitest since the need is basically same. The error stack formatting uses
parseErrorStacktraceutility provided by@vitest/utils. Forconsoleformatting though, as it depends on external dependencyloupeor@vitest/pretty-format, I didn't use the one from@vitest/utilsand instead, copied the similar logic directly to Vite but without sophisticated object formatting.
Comparison with other tools
There are plugins providing similar features, but they didn't seem to have proper stack trace mapping nor console argument formatting.
vite-plugin-mcpis in this repo)Many bundles have similar features as builtin. Most off them enable it by default, but Next.js seems to have this as op-in still (it could be just due to their test infra harder to adopt). You can find examples in:
Follow-up discussion if needed
Example