Skip to content

Vite 8.4 lets you lock down dev server file access

The release adds an opt-in allow-list for Vite file-serving checks, due to become the default in the next major version, plus subpath imports inside CSS url().

Source: Vite

Vite 8.4, released on 26 November, adds an opt-in allow-list for the dev server’s file-serving checks. Until now, Vite worked from a block-list, serving anything except a set of sensitive paths. Combining the new server.fs.strict: 'extended' option with server.fs.allow: [] flips that: only files you list get served, and plugin-loaded modules are checked too. The Vite team says it plans to make the allow-list approach the default in the next major version.

// vite.config.js
export default {
  server: {
    fs: { strict: 'extended', allow: [] },
  },
}

The same release lets CSS url() references resolve as subpath imports, falling back to a raw hash URL only if that resolution fails. Vite recommends subpath imports over resolve.alias or tsconfig paths, since both Node.js and TypeScript support them natively. Dynamic imports also get a fix: the preload helper now re-fetches CSS for a chunk when its import re-runs, aligning with an HTML spec change already supported in Chrome 156, Firefox 155 and Safari Technology Preview 252.

Why it matters: a block-list only stops what its authors thought to block; an allow-list stops everything else by default. If your dev server ever runs somewhere exposed or shared, turning on server.fs.strict: 'extended' now is worth doing ahead of it becoming mandatory.

Share

Related reading

More from The Wire

All briefs