FG
๐Ÿ’ป Software๐ŸŒ Web & Full-Stack

avoid writing the temporary file when evaluating the config file

Freshover 1 year ago
Mar 14, 20260 views
Confidence Score80%
80%

Problem

Description I run vite inside a docker container for security reasons. My `docker run` looks like: [code block] As you can see, the application code files are read-only and they can't be changed from inside the docker container (for example, some mistake like `rm -rf *` can't remove all my code files). But since version 3.0.1, `vite build` creates the `vite.config.js.mjs` file in the root directory, and since version 3.0.3 it creates a file with a random name like `vite.config.js.timestamp-1659277944620.mjs`. Because my application root is the read-only, then `docker container exec -i "myApp" bash -l -c 'npm run build'` fails with error: [code block] Suggested solution Write file only to explicitly set directories. Alternative _No response_ Additional context _No response_ 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 request the same feature to avoid creating a duplicate.

Error Output

Error: EROFS: read-only file system, open '/var/www/myApp/vite.config.js.timestamp-1659277944620.mjs'

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
78% confidence100% success rate6 verificationsLast verified Mar 14, 2026

Solution: avoid writing the temporary file when evaluating the config file

Low Risk

These `vite.config.js.timestamp-1680094124134.mjs` files also cause race conditions with `make`'s dependency tracking because the file only exists momentarily and if it's removed after the `make` invocation, make will terminate with such errors: [code block] Can this file be removed or at least be moved to vite's temp dir `node_modules/.vite`?

78

Trust Score

6 verifications

100% success
  1. 1

    These `vite.config.js.timestamp-1680094124134.mjs` files also cause race conditi

    These `vite.config.js.timestamp-1680094124134.mjs` files also cause race conditions with `make`'s dependency tracking because the file only exists momentarily and if it's removed after the `make` invocation, make will terminate with such errors:

  2. 2

    Can this file be removed or at least be moved to vite's temp dir `node_modules/.

    Can this file be removed or at least be moved to vite's temp dir `node_modules/.vite`?

Validation

Resolved in vitejs/vite GitHub issue #9470. Community reactions: 17 upvotes.

Verification Summary

Worked: 6
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

vitebuild-tooljavascriptenhancement