Vite’s dev server is fast partly because it serves files straight from disk. That convenience has also been the source of several file-access security fixes over the years. The new Vite 8.4.0-beta.1, published on 16 November 2026, adds two features that let you lock the dev server down further: a stricter server.fs.strict: 'extended' mode and a plugin API called environment.addSafeModule().

This guide explains both, shows how to try the beta safely, and walks through the other notable changes in the release. Everything here comes from the official v8.4.0-beta.1 release notes and the Vite docs on GitHub. Remember it is a beta: the stable latest tag on npm is still 8.3.8.

Try the beta in a branch

git switch -c try-vite-8.4-beta
npm install -D vite@beta     # the beta dist-tag currently points to 8.4.0-beta.1
npx vite --version

Run your dev server, your test suite and a production build. If anything breaks, you can switch back to vite@latest in one command.

Recap: what server.fs.strict does

By default (server.fs.strict: true, enabled since Vite 2.7), Vite refuses to serve files outside the workspace root through /@fs/ URLs. Requests for files outside server.fs.allow that are not imported from an allowed file get a 403. server.fs.deny adds a blocklist (for example .env files) on top.

The gap: those checks focus on files requested directly. Modules that plugins load were not covered in the same way.

New: server.fs.strict: 'extended'

The option now accepts a third value. According to the updated config docs, 'extended' also applies the access checks to modules loaded by plugins, except IDs starting with \0 (the convention for virtual modules).

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

export default defineConfig({
  server: {
    fs: {
      strict: 'extended',
      // add any extra folders your app legitimately reads from
      allow: ['..'],
    },
  },
})

When to turn it on

  • Your dev server is reachable by other machines (--host, containers, cloud IDEs, tunnels).
  • You use plugins that load files by path and you want those loads checked too.
  • You want defence in depth against path-traversal style bugs in the dev server.

What might break

A plugin that inserts a reference to a file Vite can’t discover through import analysis, for example a runtime helper outside your project, may now get a 403 in dev. You have two fixes: add the path to server.fs.allow, or (better) have the plugin register the module as safe.

New: environment.addSafeModule() for plugin authors

The second feature exists so users don’t have to widen server.fs.allow just because a plugin injects a reference. During dev, a plugin can call this.environment.addSafeModule(id) to mark a resolved module ID as safe to load even outside server.fs.allow. server.fs.deny still applies.

The docs give these rules:

  • Pass a normalized absolute path (use Vite’s normalizePath), optionally with a query.
  • Vite registers the full ID and the path with query and hash removed; other query variants must be registered separately.
  • Call it in the same transform hook where you add the reference.
  • Safe module lists are separate per environment (client, SSR and so on).

Here is the pattern from the docs. runtimeId is the normalized absolute path (optionally with a query), and runtimeUrl is the URL you insert into the transformed code:

import type { Plugin } from 'vite'

export function runtimePlugin(runtimeId: string, runtimeUrl: string): Plugin {
  return {
    name: 'plugin-runtime',
    transform: {
      filter: { code: '__RUNTIME_URL__' },
      handler(code) {
        if (this.environment.mode === 'dev') {
          this.environment.addSafeModule(runtimeId)
        }
        return code.replaceAll('__RUNTIME_URL__', JSON.stringify(runtimeUrl))
      },
    },
  }
}

To build runtimeId from a file in your plugin package, combine Node’s fileURLToPath() with Vite’s normalizePath() so the path uses forward slashes on every OS:

import { normalizePath } from 'vite'
import { fileURLToPath } from 'node:url'

const runtimeId = normalizePath(
  fileURLToPath(new URL('./runtime/client.js', import.meta.url)),
)

If you maintain a plugin, test it with strict: 'extended' now so your users can enable it without workarounds.

Other changes worth knowing

The beta includes a long list of features and fixes. A few that affect day-to-day work:

Build and manifest

  • Worker chunks are now included in the build manifest. Useful for backend integrations (Laravel, Rails, Django) that read manifest.json.
  • The build environment exposes the build manifest, so plugins can read it.
  • Failed CSS preloads can be retried, which helps users on flaky connections after a deploy.

CSS

  • Empty CSS files are no longer emitted.
  • Subpath imports work in CSS url(), so #assets/logo.svg style aliases from package.json imports resolve in stylesheets.
  • css.devSourcemap moves to dev.sourcemap.css. The docs describe dev.sourcemap as boolean | { js?: boolean; css?: boolean } with a default of { js: true, css: false }:
export default defineConfig({
  dev: {
    sourcemap: { js: true, css: true },
  },
})

WebAssembly and preview

  • Source phase imports for Wasm are supported.
  • vite preview serves Wasm compressed.

CLI and config loading

  • --configLoader is now stable, and --configLoader=runner is deprecated. The CLI docs list bundle (default, bundles the config with Rolldown) and native (loads it with the native runtime).
  • Vite now shows a running process for the same project, which helps when you accidentally start a second dev server.

Removed

  • optimizeDeps.rollupOptions was removed in this beta. If your config sets it, the beta is a good time to find out what replaces your use case before 8.4 goes stable.

Security-flavoured fixes

The bug-fix list includes escaping import specifiers and escaping imported names in transformCjsImport, both small hardening changes in code generation.

A safe upgrade checklist

  1. Install vite@beta in a branch and run dev, tests and build.
  2. Grep your config for css.devSourcemap, optimizeDeps.rollupOptions and --configLoader=runner.
  3. Turn on server.fs.strict: 'extended' and click through your app in dev. Watch the terminal and browser console for 403s.
  4. For each 403, decide: is it a real file the app needs (add to server.fs.allow) or a plugin reference (ask the plugin to call addSafeModule)?
  5. If you rely on manifest.json, check the new worker entries don’t confuse your backend integration.
  6. Report regressions on the Vite issue tracker while it is still beta.

Takeaway

Vite 8.4 is shaping up as a quiet but useful release: server.fs.strict: 'extended' lets you apply file-access checks to plugin-loaded modules, and addSafeModule() gives plugin authors a clean way to keep working under that stricter mode. Try the beta in a branch now, especially if your dev server is exposed beyond localhost. Details are in the release notes.