Vite 8.4 Turns Your Dev Server Into an Allow-List — Here's How to Opt In Today
Vite 8.4 landed on November 26, 2026, and its headline feature is the kind of change you should adopt before it becomes mandatory: an opt-in allow-list for dev server file serving. The Vite team has said plainly that the
Vite 8.4 landed on November 26, 2026, and its headline feature is the kind of change you should adopt before it becomes mandatory: an opt-in allow-list for dev server file serving. The Vite team has said plainly that they intend to make it the default in the next major version — so the time to test it against your project is now, while it's still optional and the failure mode is a config tweak, not a broken build.
This post walks through what changed, how to enable the allow-list in about ten minutes, what will break (and how to fix it), and the rest of the 8.4 release — including dynamic imports that can finally recover from a failed fetch.
The problem: a block-list can't keep up
Since Vite 2.7, the dev server has had a server.fs file serve check — a security feature that stops the dev server from handing out files if it becomes reachable by a threat actor. Think coffee-shop Wi-Fi, a misconfigured --host flag, or a dev server accidentally exposed on a shared network: without the check, anyone who can reach the server could request files outside your project.
The trouble is that the check worked as a block-list. You and Vite had to enumerate the sensitive files to deny, and attackers kept finding bypasses that exploit quirks of the file system and HTTP parsing. The Vite team has been patching those bypasses for years, but as the announcement puts it, "given that the number of attacks are increasing," patching a block-list is a losing game. Every bypass is a new CVE-shaped hole; every fix risks breaking someone's legitimate setup.
An allow-list flips the logic. Instead of listing what's forbidden, you list what's permitted — and everything else is denied by default. It's the same principle as firewall rules, and it's strictly harder to bypass: there is no clever path traversal that makes a file "allowed" if it was never referenced by your app in the first place.
Opting in: two lines in your config
The allow-list mode is opt-in in 8.4. You enable it by combining two settings:
// vite.config.ts
import { defineConfig } from 'vite'
export default defineConfig({
server: {
fs: {
// 'extended' applies the checks to modules loaded by plugins too
strict: 'extended',
// An empty allow list + extended strict mode = allow-list mode.
// Only files referenced from the entrypoint (including transitive
// references) will be served.
allow: [],
},
},
})
That's it. With server.fs.strict: 'extended' and server.fs.allow: [], Vite only serves files reachable from your entrypoint, including transitive references. Two details make this work in practice:
-
Plugin-loaded modules are covered. The new
'extended'strict mode applies the checks to modules loaded by plugins, not just your own imports — previously a plugin could pull in a file the check never saw. -
CSS references count. Vite now registers referenced modules in the allow-list not only via
importbut also via other paths such asurl()in CSS. If your stylesheet references a font or an image, it stays servable.
How to test it safely
Don't flip this on in the middle of a deadline. Do it in a branch and run your normal dev loop:
# 1. Update Vite
pnpm add -D vite@^8.4.0
# 2. Add the config above, then start the dev server
pnpm dev
# 3. Click through every route, open every page that loads
# fonts, images, or workers, and watch the terminal.
# Anything blocked shows up as a file-serve error —
# add it to server.fs.allow or fix the reference.
Then deliberately try to break it. From another machine on the same network (or with curl from your own), request a file that is not part of your app graph — say, a config file sitting next to the project:
# With the dev server running on :5173, try to reach outside the graph.
# In allow-list mode this should NOT return the file's contents.
curl -s http://localhost:5173/@fs/Users/you/.ssh/config | head -5
If you get file contents back, the allow-list isn't active. If you get an error, it's working.
What breaks — and the fix for each case
Assets referenced without an import. If something in your app loads a file through a path Vite can't trace from the entrypoint — a runtime-constructed URL, a worker loaded by string, a file referenced only in a comment — the dev server will refuse to serve it. The fix is to add the file or directory explicitly to server.fs.allow, or better, to reference it through a real import so it's part of the graph.
Plugin-generated modules. If you maintain a Vite plugin that generates a module referencing an asset without an import, your users would have to add that asset to server.fs.allow by hand. Don't make them. The 8.4 API gives plugin authors a proper escape hatch — call this.environment.addSafeModule so the module is registered in the allow-list automatically:
// inside your Vite plugin
export default function myPlugin(): Plugin {
return {
name: 'my-plugin',
resolveId(id) {
if (id === 'virtual:generated-asset') {
return '\0virtual:generated-asset'
}
},
load(id) {
if (id === '\0virtual:generated-asset') {
// Register the asset this generated module references,
// so users don't need to touch server.fs.allow.
this.environment.addSafeModule('/absolute/path/to/asset.png')
return `export default '/assets/generated.png'`
}
},
}
}
If you ship a Vite plugin, test it with server.fs.allow: [] now. Your users will thank you when the next major flips the default — and you won't be the plugin whose README gains a "add this to your allow list" workaround section.
Dynamic imports that can finally recover
The second headline feature fixes a papercut every frontend developer has felt: a lazy route or a dynamically imported component fails to load — flaky hotel Wi-Fi, a deploy that just replaced the chunk, a CDN hiccup — and the app is stuck. The user clicks again and it still fails, because the failed import is cached as failed.
The HTML specification was updated this July to let browsers retry failed module fetches for dynamic imports. The behavior is implemented in Chrome 156+, Firefox 155+, and Safari Technology Preview 252 — and Vite 8.4 improves its preload helper so that the CSS for a dynamic chunk is re-fetched when the dynamic import is re-executed:
export const onClick = async () => {
// Before: this import threw an error
// if the fetch failed even for the second click
//
// After: the import succeeds if the fetch on the second
// click succeeds even after the first fetch failed
// (if the browser supports it)
const SuccessComponent = await import('./Success.ts')
render(SuccessComponent)
}
This is the code sample straight from the Vite announcement, and it captures the whole change: same code, different outcome on the second click. No retry logic to write, no error boundary to wire up — the platform handles it, and Vite's preload helper makes sure the chunk's CSS comes along for the ride instead of arriving stale.
Practical note: this only helps where the browser supports the new behavior, so keep your existing error handling for older browsers. But for the growing majority on current Chrome and Firefox, "chunk failed to load, please refresh" becomes a much rarer sight.
The rest of 8.4, in brief
Subpath imports in CSS url(). Vite has supported Node-style subpath imports (the "exports" field in package.json) for a while, but they didn't work inside CSS url() because of a conflict with hash URLs. Now Vite tries to resolve a url() value as a subpath import and falls back to the raw hash URL if resolution fails. The team now recommends subpath imports over resolve.alias or tsconfig paths, because they're supported by Node.js and TypeScript alike:
/* Before: alias or relative path */
@import url('@/assets/fonts/inter.woff2');
/* Now: a package subpath import, resolved by Vite */
@import url('#assets/fonts/inter.woff2');
Duplicate CLI process detection. Run a dev server for a project that's already running, and Vite now exits with an error naming the running process instead of silently starting a second one:
Found another Vite dev process for this project at http://localhost:5173/ (PID 12345).
Pass --bypass-lock to bypass this check.
If you genuinely need two servers for one project, --bypass-lock skips the check. For everyone else, this kills the "why is my HMR talking to the wrong server" debugging session.
Wasm source phase imports. You can now import a .wasm file with a source phase import and get the WebAssembly.Module value directly:
import source mod from './mod.wasm'
const instance = await WebAssembly.instantiate(mod, {
'./imports.js': { someFunc: () => {} },
})
This is supported by TypeScript 7.1, which is currently in beta. Once TypeScript 7.1 is stable, the Vite team recommends using source phase imports over the Vite-specific .wasm?init feature.
Highly experimental bundled dev mode for SSR. There's early support for a bundled dev mode for SSR, aimed at meta-frameworks. It's explicitly highly experimental — the foundation for future work, not something to build on today.
Vite 8.4 also ships with create-vite 9.4.0, and the release is the work of more than 1,300 contributors to Vite Core.
Your upgrade checklist
-
Update:
pnpm add -D vite@^8.4.0(or your package manager's equivalent), plus[email protected]if you scaffold new projects. -
Opt into the allow-list in a branch with
server.fs.strict: 'extended'andserver.fs.allow: []. Click through every route and check the terminal for blocked files. -
Fix what breaks at the source — prefer real imports over
server.fs.allowentries, and if you maintain a plugin, addaddSafeModulecalls for generated modules. - Test your lazy routes on a throttled connection to see the dynamic import retry in action (Chrome 156+ / Firefox 155+).
-
Swap CSS
url()aliases for subpath imports where you can — it's the direction the team is recommending. - Keep the next major on your radar. The allow-list becomes the default there, so the work you do now is the work you won't have to rush later.
Vite 8.4 is a security release disguised as a minor version bump. The allow-list is the headline, but the through-line is the same: the dev server is getting stricter, the platform is getting more capable, and the migration path is deliberately gentle. Take the ten minutes now.
Sources
- Vite, "Vite 8.4 is out!", November 26, 2026: https://vite.dev/blog/announcing-vite8-4
- Vite GitHub changelog (linked from the announcement): https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md
Thanks for reading! I'm Shaswat Raj — I build CampusLoop, IndexFast, SopKit and open-source dev tools.
GitHub: https://github.com/playlikeboy/ · LinkedIn: https://www.linkedin.com/in/sh20raj/ · YouTube: https://youtube.com/@stackshade
Have you tried the allow-list mode yet — and did anything in your project break when you turned it on? Share what you found in the comments.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.