eleventy-dev-server icon indicating copy to clipboard operation
eleventy-dev-server copied to clipboard

Dev server has to be restarted to passthrough newly added image files

Open NathanBowers opened this issue 1 year ago • 1 comments

When adding a new image to a project Eleventy dev server has to be restarted for the new image to be served.

  • This is using .addPassthroughCopy("src/img/**/*.{png,gif,jpg,jpeg,pdf,svg,webp}"); in eleventy.js
  • Eleventy version: @11ty/[email protected]
  • Tried server with and without --incremental and it didn't help.

Reproduce:

  1. Have an eleventy project
  2. Add an image folder with some images
  3. Use addPassthroughCopy for those images to your config
  4. Create any html template that would render out an <img> element referencing one of the images in your project
  5. Start server
  6. View your template with <img> in web browser
  7. Add a new image file to your image folder
  8. Add a new <img> element to your html template referencing your newly added image file
  9. The new image will not be available and appears as a broken img src until the dev server is restarted

NathanBowers avatar Mar 13 '23 20:03 NathanBowers

Successfully reproduced when using eleventyConfig.setServerPassthroughCopyBehavior("passthrough");

Works as expected with default behavior (eleventyConfig.setServerPassthroughCopyBehavior("copy");)

zachleat avatar Jun 04 '24 16:06 zachleat