Skip to content

feat: track dependencies when loading config with native#22602

Merged
sapphi-red merged 5 commits into
vitejs:mainfrom
sapphi-red:config-loader-native-track-deps-2
Jun 12, 2026
Merged

feat: track dependencies when loading config with native#22602
sapphi-red merged 5 commits into
vitejs:mainfrom
sapphi-red:config-loader-native-track-deps-2

Conversation

@sapphi-red

@sapphi-red sapphi-red commented Jun 4, 2026

Copy link
Copy Markdown
Member

Adds support for restarting the server when the dependency of the config file is edited for Node. This does not work in deno and bun as they don't support loaders.

The tests are not added but it is covered on the dep side.

close #21655
part of #21546

@sapphi-red sapphi-red added this to the 8.1 milestone Jun 4, 2026
@sapphi-red sapphi-red added the p2-nice-to-have Not breaking anything but nice to have (priority) label Jun 4, 2026
@sapphi-red

Copy link
Copy Markdown
Member Author

/ecosystem-ci run

@pkg-pr-new

pkg-pr-new Bot commented Jun 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/plugin-legacy

pnpm add https://pkg.pr.new/@vitejs/plugin-legacy@22602 -D
npm i https://pkg.pr.new/@vitejs/plugin-legacy@22602 -D
yarn add https://pkg.pr.new/@vitejs/plugin-legacy@22602.tgz -D

vite

pnpm add https://pkg.pr.new/vite@22602 -D
npm i https://pkg.pr.new/vite@22602 -D
yarn add https://pkg.pr.new/vite@22602.tgz -D

commit: 3e741f9

@vite-ecosystem-ci

Copy link
Copy Markdown

📝 Ran ecosystem CI on a02e7ed: Open

suite result latest scheduled
marko success failure
astro failure failure
react-router failure failure
vike failure success
tanstack-start failure failure
vitest failure failure
vite-plugin-cloudflare failure failure

laravel, analogjs, nuxt, sveltekit, qwik, vite-plugin-svelte, vite-plugin-react, unocss, vite-plugin-vue, module-federation, vitepress, vite-setup-catalogue, vite-plugin-pwa, vite-environment-examples, quasar, waku, vuepress, vite-plugin-rsc, storybook

@sapphi-red

Copy link
Copy Markdown
Member Author

I just found out that deno supports module.registerHooks. So it should work on deno.

Comment thread packages/vite/src/node/config.ts Outdated
@sapphi-red sapphi-red merged commit a7e2da8 into vitejs:main Jun 12, 2026
28 of 30 checks passed
@sapphi-red sapphi-red deleted the config-loader-native-track-deps-2 branch June 12, 2026 11:27
foreverrbum added a commit to foreverrbum/ai-code-review that referenced this pull request Jun 15, 2026
…t() not language()

The _load_language helper called mod.language() for all grammars, but
tree_sitter_typescript exports language_typescript() and language_tsx()
rather than the generic language() that Python, JS, and Go use.
The AttributeError was silently swallowed, so TypeScript AST extraction
(function bodies, call sites, imports) returned empty results for every
.ts/.tsx file.

Fix: store the exact exported function name per extension in the mapping
dict and call getattr(mod, func_name)() instead of mod.language().

Also add arrow_function to FUNCTION_NODE_TYPES for ts/tsx so
const-assigned arrow functions are extracted alongside declarations.

Caught by testing against vitejs/vite#22602 — zero function bodies
retrieved from a 87K-char config.ts before the fix; 39 functions and
both changed bodies extracted correctly after.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2-nice-to-have Not breaking anything but nice to have (priority) trigger: preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Watch files imported by the config on Node.js for --configLoader native

2 participants