-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix(config): workaround failure creating temporary file (take 2) #19952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
If node_modules is not writable, loadConfigFromBundledFile fails to write its temp file and vite aborts with an exception. This was previously fixed in vitejs#13269, but was reverted after several reports of failure to load config with relative imports (see vitejs#13631 and vitejs#13730). Instead of replacing the current code, try to load from string only as a workaround, when the directory doesn't exist. This should solve the case of unwritable node_modules when relative imports are not used without breaking anything that works.
Have you tried |
If vite/packages/vite/src/node/config.ts Lines 2018 to 2046 in b5f70dd
How does the error happen in your case? |
The project directory is also not writable. |
Interesting, I'll try that. Is it possible to use them as fallback automatically in case writing of the temp file fails? |
Or at least print a useful error message with instructions on failure? |
If node_modules is not writable, loadConfigFromBundledFile fails to write its temp file and vite aborts with an exception.
This was previously fixed in #13269, but was reverted after several reports of failure to load config with relative imports (see #13631 and #13730).
Instead of replacing the current code, try to load from string only as a workaround, when the directory doesn't exist.
This should solve the case of unwritable node_modules when relative imports are not used without breaking anything that works.