Build fails when running in mapped Windows network drive (UNC issue)
Describe the bug
Running vite or vite build in a network drive results in error,
it seems that the path gets magled by including the UNC representation of the mapped drive.
Setup:
- Windows 11
- mapped
RedactedServerto myK:drive
Everything works fine if I move all the project to the C: drive (eg. C:\Users\MyUser\Downloads\test)
error during build:
[vite:load-fallback] Could not load /RedactedServer/Projects/test/index.html: ENOENT: no such file or directory, open 'K:\RedactedServer\Projects\test\index.html'
at async open (node:internal/fs/promises:636:25)
at async Object.readFile (node:internal/fs/promises:1246:14)
at async Object.load (file:///K:/Projects/test/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:64965:25)
at async PluginDriver.hookFirstAndGetPlugin (file:///K:/Projects/test/node_modules/rollup/dist/es/shared/node-entry.js:19792:28)
at async file:///K:/Projects/test/node_modules/rollup/dist/es/shared/node-entry.js:18956:33
at async Queue.work (file:///K:/Projects/test/node_modules/rollup/dist/es/shared/node-entry.js:20002:32)
K:/Projects/test becomes /RedactedServer/Projects/test which is the correct UNC representation, but K:\RedactedServer\Projects\test\index.html is searched, which doesn't exist
Reproduction
https://stackblitz.com/edit/vitejs-vite-kskx93?file=index.html&terminal=dev
Steps to reproduce
# in a windows mapped network drive
npm create vite@latest test -- --template react-ts
cd test
npm i
npm run build
System Info
System:
OS: Windows 11 10.0.22631
CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Memory: 15.23 GB / 31.85 GB
Binaries:
Node: 20.14.0 - C:\Program Files\nodejs\node.EXE
npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 127.0.6533.100
Edge: Chromium (127.0.2651.86)
Internet Explorer: 11.0.22621.3527
npmPackages:
@vitejs/plugin-react: ^4.3.1 => 4.3.1
vite: ^5.4.0 => 5.4.0
Used Package Manager
npm
Logs
Click to expand
vite:config bundled config file loaded in 578.35ms +0ms
vite:config using resolved config: {
vite:config plugins: [
vite:config 'vite:build-metadata',
vite:config 'vite:watch-package-data',
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'vite:react-babel',
vite:config 'vite:react-refresh',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html-inline-proxy',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm-helper',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite:wasm-fallback',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:build-html',
vite:config 'vite:worker-import-meta-url',
vite:config 'vite:asset-import-meta-url',
vite:config 'vite:force-systemjs-wrap-complete',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'vite:dynamic-import-vars',
vite:config 'vite:import-glob',
vite:config 'vite:build-import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:terser',
vite:config 'vite:reporter',
vite:config 'vite:load-fallback'
vite:config ],
vite:config build: {
vite:config target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
vite:config cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
vite:config outDir: 'dist',
vite:config assetsDir: 'assets',
vite:config assetsInlineLimit: 4096,
vite:config cssCodeSplit: true,
vite:config sourcemap: false,
vite:config rollupOptions: { onwarn: [Function: onwarn] },
vite:config minify: 'esbuild',
vite:config terserOptions: {},
vite:config write: true,
vite:config emptyOutDir: null,
vite:config copyPublicDir: true,
vite:config manifest: false,
vite:config lib: false,
vite:config ssr: false,
vite:config ssrManifest: false,
vite:config ssrEmitAssets: false,
vite:config reportCompressedSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null,
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
vite:config modulePreload: { polyfill: true },
vite:config cssMinify: true
vite:config },
vite:config esbuild: { jsxDev: false, jsx: 'automatic', jsxImportSource: undefined },
vite:config optimizeDeps: {
vite:config holdUntilCrawlEnd: true,
vite:config esbuildOptions: { preserveSymlinks: false, jsx: 'automatic' },
vite:config include: [ 'react', 'react/jsx-dev-runtime', 'react/jsx-runtime' ]
vite:config },
vite:config resolve: {
vite:config mainFields: [ 'browser', 'module', 'jsnext:main', 'jsnext' ],
vite:config conditions: [],
vite:config extensions: [
vite:config '.mjs', '.js',
vite:config '.mts', '.ts',
vite:config '.jsx', '.tsx',
vite:config '.json'
vite:config ],
vite:config dedupe: [ 'react', 'react-dom' ],
vite:config preserveSymlinks: false,
vite:config alias: [ [Object], [Object] ]
vite:config },
vite:config configFile: 'K:/Projects/test/vite.config.ts',
vite:config configFileDependencies: [ 'K:/Projects/test/vite.config.ts' ],
vite:config inlineConfig: {
vite:config root: undefined,
vite:config base: undefined,
vite:config mode: undefined,
vite:config configFile: undefined,
vite:config logLevel: undefined,
vite:config clearScreen: undefined,
vite:config build: {}
vite:config },
vite:config root: 'K:/Projects/test',
vite:config base: '/',
vite:config decodedBase: '/',
vite:config rawBase: '/',
vite:config publicDir: 'K:/Projects/test/public',
vite:config cacheDir: 'K:/Projects/test/node_modules/.vite',
vite:config command: 'build',
vite:config mode: 'production',
vite:config ssr: {
vite:config target: 'node',
vite:config optimizeDeps: { noDiscovery: true, esbuildOptions: [Object] }
vite:config },
vite:config isWorker: false,
vite:config mainConfig: null,
vite:config bundleChain: [],
vite:config isProduction: true,
vite:config css: { lightningcss: undefined },
vite:config server: {
vite:config preTransformRequests: true,
vite:config sourcemapIgnoreList: [Function: isInNodeModules$1],
vite:config middlewareMode: false,
vite:config fs: {
vite:config strict: true,
vite:config allow: [Array],
vite:config deny: [Array],
vite:config cachedChecks: undefined
vite:config }
vite:config },
vite:config preview: {
vite:config port: undefined,
vite:config strictPort: undefined,
vite:config host: undefined,
vite:config https: undefined,
vite:config open: undefined,
vite:config proxy: undefined,
vite:config cors: undefined,
vite:config headers: undefined
vite:config },
vite:config envDir: 'K:/Projects/test',
vite:config env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
vite:config assetsInclude: [Function: assetsInclude],
vite:config logger: {
vite:config hasWarned: false,
vite:config info: [Function: info],
vite:config warn: [Function: warn],
vite:config warnOnce: [Function: warnOnce],
vite:config error: [Function: error],
vite:config clearScreen: [Function: clearScreen],
vite:config hasErrorLogged: [Function: hasErrorLogged]
vite:config },
vite:config packageCache: Map(1) {
vite:config 'fnpd_K:/Projects/test' => {
vite:config dir: 'K:/Projects/test',
vite:config data: [Object],
vite:config hasSideEffects: [Function: hasSideEffects],
vite:config webResolvedImports: {},
vite:config nodeResolvedImports: {},
vite:config setResolvedCache: [Function: setResolvedCache],
vite:config getResolvedCache: [Function: getResolvedCache]
vite:config },
vite:config set: [Function (anonymous)]
vite:config },
vite:config createResolver: [Function: createResolver],
vite:config worker: { format: 'iife', plugins: '() => plugins', rollupOptions: {} },
vite:config appType: 'spa',
vite:config experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false },
vite:config getSortedPlugins: [Function: getSortedPlugins],
vite:config getSortedPluginHooks: [Function: getSortedPluginHooks]
vite:config } +37ms
vite v5.4.0 building for production...
✓ 0 modules transformed.
x Build failed in 22ms
error during build:
[vite:load-fallback] Could not load /RedactedServer/Projects/test/index.html: ENOENT: no such file or directory, open 'K:\RedactedServer\Projects\test\index.html'
at async open (node:internal/fs/promises:636:25)
at async Object.readFile (node:internal/fs/promises:1246:14)
at async Object.load (file:///K:/Projects/test/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:64965:25)
at async PluginDriver.hookFirstAndGetPlugin (file:///K:/Projects/test/node_modules/rollup/dist/es/shared/node-entry.js:19792:28)
at async file:///K:/Projects/test/node_modules/rollup/dist/es/shared/node-entry.js:18956:33
at async Queue.work (file:///K:/Projects/test/node_modules/rollup/dist/es/shared/node-entry.js:20002:32)
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
I have the same issue. It was working before and I came back to the project after maybe two months and now it doesn't. I didn't change anything but I don't control the OS. It's a VM controlled by my employer. So it might have something to do with a Windows update.
System Info
System:
OS: Microsoft Windows 10 Enterprise (10.0.19044 Build 19044)
CPU: Intel(R) Xeon(R) Gold 6150 CPU @ 2.70GHz, 2700 Mhz, 4 Core(s), 4 Logical Processor(s)
Memory: 4.4 GB / 16.0 GB
OS Name
Binaries:
Node: 20.17.0 - D:\packages\node\20.17.0
npm: 10.8.2 - D:\packages\node\20.17.0\npm.CMD
npm Packages:
@vitejs/plugin-react: ^4.2.1
vite: ^5.2.0
Same here, even with mapped drive D:\ pointing only into C:\Users\<UserName>\Work, which is just a folder in my local PC's local SSD, on the local C:\ drive.
Let's track this together with #10802