11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.13k stars 493 forks source link

Setting setServerPassthroughCopyBehavior('passthrough') with Vite not working #2979

Open shoogstoel opened 1 year ago

shoogstoel commented 1 year ago

Operating system

Ubuntu

Eleventy

2.0.1

Describe the bug

When using setServerPassthroughCopyBehavior('passthrough'); in conjunction with '@11ty/eleventy-plugin-vite' results in the following error, when trying to run npx @11ty/eleventy --serve:

Init options have not yet been fetched in the setup callback. This probably means that `init()` has not yet been called.

Are there any known limitations when using Vite as middleware? Is there anything else I have to take care of when using passthrough?

Reproduction steps

No response

Expected behavior

No response

Reproduction URL

No response

Screenshots

No response

groenroos commented 7 months ago

Running into the same issue - worth noting that it doesn't matter whether server.middlewareMode in Vite settings is true or false.

It also appears that if passthrough behaviour is set to "copy", Vite doesn't seem to pick up changes to copied asset folders to trigger HMR

asbjornu commented 5 months ago

Yep, I just stumbled upon this error as well.