11ty / eleventy-plugin-template-languages

Official template syntax plugins for Eleventy
MIT License
2 stars 2 forks source link

With --serve, changing a partial triggers a rebuild but doesn't use the updated partial #7

Open RickMohr opened 1 year ago

RickMohr commented 1 year ago

Operating system

Windows 10

Eleventy

2.0.1

Describe the bug

If you run 11ty in "serve" mode and change a partial file, a rebuild is triggered but the changed partial is not used.

Note that several comments at the bottom of https://github.com/11ty/eleventy/issues/596 describe similar issues (both MacOS and Windows).

Reproduction steps

This dead-simple project demonstrates the issue. From its README:

  1. npm install
  2. npx eleventy --serve
  3. Browse to localhost:8080 -- you should see "Hello Bug!"
  4. Change src/_includes/world.hbs to contain "World!" instead of "Bug!" -- a rebuild is triggered and the page is reloaded, but it still says "Hello Bug!"
  5. Restart npx eleventy --serve and reload the page -- now you correctly see "Hello World!"

Expected behavior

After changing "Bug!" to "World!" the web page should show "Hello World!" without needing to restart the server.

Reproduction URL

https://github.com/RickMohr/eleventyBug

Screenshots

No response

RickMohr commented 1 year ago

This is a problem when using handlebars (as shown in the example), but not when using nunjucks.

johannesrave commented 1 year ago

a similar or the same thing happens when using WebC components. changing a component triggers a rebuild, but the files (and accordingly, the browser preview) aren't updated. looking at the extended logs by running DEBUG=ELEVENTY* npx eleventy --serve shows me, that unchanged files are being rendered again. this was reported in the discord-help section as well - seems like some kind of cache invalidation bug to me.

johannesrave commented 1 year ago

ah, looks like a duplicate of https://github.com/11ty/eleventy/issues/2924

johannesrave commented 1 year ago

for me this (mostly) works in the current alpha installed directly from github, in my case using pnpm: pnpm add -D github:11ty/eleventy#v2.0.2-alpha.2

zachleat commented 4 months ago

This is likely fixed by the new handlebars compat plugin for Eleventy 3.0+

peekxc commented 3 months ago

(this has also been a longstanding issue with the pugjs plugin, so seems systematic)