Skip to content
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

Adding a watch target triggers rebuild but no reload #99

Open
jeremenichelli opened this issue Dec 18, 2024 · 0 comments
Open

Adding a watch target triggers rebuild but no reload #99

jeremenichelli opened this issue Dec 18, 2024 · 0 comments

Comments

@jeremenichelli
Copy link

Hi folks, let me set the scene for the following bug. Or at least to me looks like a bug.

Bug: Files added via addWatchTarget, when changed, trigger a rebuild, but not a reload, which is desired.
Expected: Files added via addWatchTarget both rebuilds the project and reloads the browser tab.

  1. The project has a layout with a custom shortcode.
  2. The shortcode reads a file async and returns a string.
  3. Because modifying this external file changes the final output I want to add that file as part of the build/reload pipeline.
  4. Adding the file through addWatchTarget works triggering a rebuild, you modify the file and the site rebuilds, but you need to manually reload. Even when the final output strings has changed.
  5. Adding the directory to the watch array in the server options skips build entirely.

I created a recreation environment. The file to listen is src/assets/main.css, for the project to rebuild and reload.

eleventy_no_reload_reproduction.zip

To reproduce:

  • Download and decompress the file.
  • Run npm ci on the root folder
  • Run npm start
  • Try modifying the file src/assets/main.css
  • A build runs, but browser doesn't reload.
  • If you refresh the project in the browser you will notice the modified styles.

I tried all combinations of dev server configs (especially around domDiff and liveReload), and nothing triggers a reload which is desired and at least for expected, at least via some config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant