Problems incorporating eleventy-vite-plugin and getting my js/css found #3946
Replies: 1 comment 1 reply
-
|
Issues with Vite came up in the 11ty Discord today too. You might also want to checkout this issue for some background.. While it is possible, Vite is tricky to get working seamlessly with Eleventy. There isn't really a 'right' way, it's more can you make it work for your use-case. Vite makes quite a few assumptions about how your project is structured and how assets are processed. For instance Vite nukes static files from your output folder copied with addPassthroughCopy unless the source files are in a 'public' folder. It's quite un-Eleventy like in that respect. Unless you really need to use Vite there are other more Eleventy friendly ways to process JS/CSS and any other assets you have. That said, what you have above is one of the simpler Vite configs I've seen with Eleventy. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have it working (in both build / dev) but it seems like a convoluted solution. I was having an issue with my js and css files not being found by Vite when running --serve, or being added to output on build.
After much AI prompting I got a config that made things work but it seems possibly convoluted (I only work on an 11ty project once a year - so my experience is limited).
I please need a real Human! Am I doing this right?
Heres what I have in my config:
The part that seems overkill for this simple test project is the viteOptions. Is that really necessary?
Here is how my 1 template file located in src look:
And here is my file structure:
Beta Was this translation helpful? Give feedback.
All reactions