-
-
Notifications
You must be signed in to change notification settings - Fork 494
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
Hot reload not working (editors note: contains good discussion on WSL2) #701
Comments
I came here to report the same (or v similar) issue as the OP. I have been editing my index.css file and expecting the reload to happen, but it doesn't.
So I am wondering if @StarfallProjects and I are actually wrong in expecting a reload after editing a source file such as index.html (I'm assuming this is a source file you are talking about, not a template?) or a CSS file. Maybe the hot reload only works when a template file is edited. |
There is some naming confusion here - apparently, any file eleventy processes is a template file: https://twitter.com/starfalldocs/status/1175425510496788481 So things like html and md files (what I would think of as "content") are also referred to as template files. |
Ah - good point. I'm new to this and I think I am getting "templates" and "layouts" confused. |
I had exactly the same confusion, hence the tweet :-) I'm so used to a template being something that gets applied to content. |
Same problem & same definition: No "re-build" after any change on any file (serve or watch) Environment: |
Can confirm the issue on Windows 10. In WSL (Ubuntu) watching works fine. I dug a bit deeper. On file changes eleventy is supposed to log "File changed:" (source) but even this does not happen on Windows. I assume it's related to this open issue in the file watcher chokidar for version 3.1.1, which is the version that got installed for me: paulmillr/chokidar#888. I force installed chokidar 3.1.0 and watching started working on Windows. When using yarn you can try to add the following to your package.json and see if it works for you:
|
With some help from @zkochan
The right "File changed" appears, the "[Browsersync] Reloading Browsers..." also but I don't get the hot reloading. |
Started a new project from scratch, and with the lines I wrote earlier (minus --saveDev) , it works perfectly!
|
Sweet, that works for me too! NOTE |
|
Can confirm that the issue is fixed for me with the latest version of chokidar. A This can probably be closed. |
I'm having the same problem, when I make a change to a js data file (in /_data/), while running "eleventy --serve", eleventy doesn't rebuild the site. If I run eleventy manually, then it rebuilds it. Should this have been fixed? Windows 10 |
A related problem: const { getDescription } = require("./helpers/templates");
eleventyConfig.addNunjucksAsyncShortcode(
"description", async value => await getDescription(value)
); Now, when |
I'm experiencing this issue on a brand new 11ty installation on Windows 10, and with a brand new Skeleventy installation (probably the same issue since it uses 11ty). I followed the Getting Started docs completely and everything installs and runs fine, but once I get to step 5 and use Note: I did read the comments about chokidar version, but the version recommended to upgrade to is already an old version in the latest 11ty, so I assume this is a new bug somewhere. Windows 10 |
Hey all, commenting again for people who may come across this issue. Thanks to Dave Rupert's tweet I did some thinking and checked for what version of WSL I was using with Seems like this might be a bug present in some versions of WSL2 as others seem to not have the issue. If you are having issues, go ahead and try reverting to WSL1. Not an ideal long-term solution but it's good enough for now! |
I ran into a similar issue. Make sure your test template has a |
This is still an issue. Here are the steps I used to reproduce this:
|
Agreed, this is still an issue. I experienced the same as @mvolkmann. edit: seems to be ok now after a restart, could also be I was editing the wrong index.html |
Per https://www.11ty.dev/docs/getting-started/#step-5-gaze-upon-your-templates
|
I don't get a browser refresh after editing any file. I'm not editing README.md. |
Maybe I understand what @pdehaan was getting at now. I CAN get hot reload to work if my pages use a layout that includes a See my list of steps to reproduce the issue from two days ago.
<html lang="en">
<body>
{{content | safe}}
</body>
</html>
With these changes in place, hot reload works for me. I can modify the content of Perhaps this issue can be closed. Please comment if this additional information doesn't fix hot reload for you. |
I just want to add that I recently switched to WSL2 and I'm experiencing the issue as well. I am testing with a page that has a body tag. |
Seconded, I've just switched to WSL2 and the reloading isn't working, it's not even detecting a file change |
I should have followed up. For me, simply moving from working with /mnt/c/projects/foo to ~/projects/foo fixed everything. I was used to working with /mnt/c so that my editors, like Visual Studio Code, could access the files. But VSC can now work w/ WSL2 directly. Also, moving to the Ubuntu file system gives you huge performance improvements. While I still think this is an "issue", I think there is a workaround that is much more preferable in general. I talk more about the process here: https://www.raymondcamden.com/2020/05/08/notes-on-upgrades-to-wsl2-and-why-you-should |
Have started moving my projects to inside the WSL folders and yes that's fixed it. Good to know of the fix/workaround. |
Still reproducible kind of this issue.
to make the project cleaner and maintainable. When I save 'another-separate-config', project does reload but it doesn't update the change of this file on the webpage or _site. |
Wow—alright sorry for the late reply here but it seems like there are about 4 different issues being tossed around here.
As 3 of the 4 reports are resolved and the fourth one is filed separate, I’m going to close this one up—thanks! |
@cfjedimaster did I miss the part you mention a real alternative as hinted at by the quoted text? it feels like you just addressed using remote-wsl again, just like in the post, which isn't a solution nor a "much more preferable workaround", as you still have to have it in $wsl not in /mnt to be able to use workspaces anywhere on your system. |
Not sure what to tell you. To me, it was a real alternative and better due to improved performance of WSL2 in general. I was offering it up here as a helpful hint, and at least one person said it helped so I guess that's something. :) |
@cfjedimaster just was hoping for an alternative you forgot to mention possibly, where we are still able to have our files in synced directories on host, instead of inside wsl, wasn't a jab at you. |
I resolved this problem by using WSL2 directory like |
I added an additional note to the Watch and Serve docs about this issue specifically. You can workaround it by moving your project directory under |
Describe the bug
I am working through the getting started tutorial. Hot reload does not work (no browser reload on save, and even with manual refresh changes are not picked up_
To Reproduce
Steps to reproduce the behavior:
Expected behavior
On save, I expected the browser to reload and my new text to display.
Environment:
The text was updated successfully, but these errors were encountered: