-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
🐛 BUG: fsonathan... Vite error when using fs
in external files
#2389
Comments
Verified. If this is an intended limitation from Vite or Astro, we should document this. |
I ran into this while trying to do some stuff with |
I also just ran into this, in a file that was only ever run on the server and never meant for the client bundle. As @aFuzzyBear said, the current solution is to remove the import on dev server start and then add back after start, which feels weiiiiiiiird. |
Ah, I believe that this is a Vite bug. fixed in vitejs/vite@4a05a6e but not yet in Astro. |
Any ideas on when the fix might land in Astro? |
Thanks Fred, for a while there I thought I was losing the plot there 😅 |
I had the same problem! @zadeviggers asap, you can track progress in #2424 |
Fixed with the with the Vite upgrade in #2424 🥳 |
@tony-sull legend thank you... |
What version of
astro
are you using?latest
What package manager are you using?
yarn
What operating system are you using?
wsl2; ubuntu 20.04, reproduced on stackblitz
Describe the Bug
Hi team,
I would like to report an issue raised in the support thread of Discord: https://discord.com/channels/830184174198718474/931342087725645834
Here I reported a
vite
error where when using nodesfs
package in external*.js
files, Vite throws an error, saying it cannot resolve dependencies,This occurs with the following import statements
The present work around is to disable the import statement when launching the dev server and enabling them shortly after launch, it does throw in build also prohibiting the final build since Its one wee file using
node.fs.writeFile()
Thanks to Muhymin for producing a reproduction,
Thank you guys for looking into this,
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-xs2jbp?file=src%2Fpages%2Findex.astro&on=stackblitz
The text was updated successfully, but these errors were encountered: