-
-
Notifications
You must be signed in to change notification settings - Fork 330
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: File watcher / live reload not working when a flake.nix created symlink is present #1641
Comments
I found I could reproduce this behavior on the nix develop
npm install
npm prebuild
npm run astro dev This creates the the Exit the astro dev environment and delete the 4 symlinks and then re-running |
I've also noticed something strange. Certain files do trigger a reload.
*Note: I didn't go back and retest all these files but at least for |
Tried adding this to the diff --git a/astro.config.mjs b/astro.config.mjs
index e62355357..ab8c5b880 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -35,4 +35,17 @@ export default defineConfig({
},
},
compressHTML: true,
-});
\ No newline at end of file
+ vite: {
+ server: {
+ watch: {
+ ignored: [
+ '**/result-demos',
+ '**/result-manuals',
+ '**/result-pills',
+ '**/.pre-commit-config.yaml',
+ ],
+ alwaysStat: true,
+ },
+ },
+ },
+}); |
Also tried adding these to the + alwaysStat: true,
+ followSymlinks: false, |
I wanted to check that the configuration mentioned above actually does something and I believe I have verified that it does after the symlinks are deleted. I deleted the symlinks and added
I think this confirms that the settings do work. However, the symlinks are still causing issues for some reason. diff --git a/astro.config.mjs b/astro.config.mjs
index e62355357..404e81730 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -35,4 +35,19 @@ export default defineConfig({
},
},
compressHTML: true,
-});
\ No newline at end of file
+ vite: {
+ server: {
+ watch: {
+ ignored: [
+ '**/result-demos',
+ '**/result-manuals',
+ '**/result-pills',
+ '**/.pre-commit-config.yaml',
+ '**/src/pages/learn.astro',
+ ],
+ alwaysStat: true,
+ followSymlinks: false,
+ },
+ },
+ },
+}); |
As some already may noticed, live reloading for the NixOS homepage broke when using the development environment provided by our nix flake. After some debugging, I figured out what causes this degradation. It seems to be caused by the presence of symlinks provided by the nix flake.
To make this bug reproducible, I set up the
reproduce-symlink-bug
branch that provides an environment to easily reproduce the bug.After cloning, entering the flake with the
inputsFrom = [ config.pre-commit.devShell ];
line commented out will result in an environment where live reload works perfectly. After uncommenting, the presence of the then generated.pre-commit-config.yaml
symlink now breaks live reloading. Commenting out and deleting the symlink again returns the environment to its normal function.This seems to be an Astro related bug, since I cannot reproduce it with either a blank Vite project nor with a blank script using chokidar, the file watching library used by Vite.
The text was updated successfully, but these errors were encountered: