11ty / eleventy-plugin-vite

A plugin to use Vite with Eleventy
135 stars 10 forks source link

Empty chunks generated by Rollup for assets in Vite’s `public` folder #14

Closed matthiasott closed 1 year ago

matthiasott commented 2 years ago

Removing lines 50 and 54 in EleventyVite.js (in https://github.com/11ty/eleventy-plugin-vite/commit/6bae645d9cbb9337fece210b914ca14f88b75f80) leads to Rollup generating empty JS files again (also see https://github.com/11ty/eleventy-plugin-vite/pull/3) when files like feeds.xml, robots.txt, or sitemap.xml are processed by Eleventy and placed in the Vite public folder in the temp directory, e.g. .11ty-vite/public/.

Generated an empty chunk: "build"
Generated an empty chunk: "feed"
Generated an empty chunk: "robots"
Generated an empty chunk: "sitemap"
image

Normally, those files should be ignored by Vite because they're in the public folder, yet they are explicitly being added to viteOptions.build.rollupOptions.input with all other items of the results array on eleventy.after. Adding the items of the results array to rollupOptions.input is needed so that all HTML files are added as entry points. So re-adding the filter() makes the most sense IMO.

Could create a PR for this – just LMK @zachleat! 🤗

KiwiKilian commented 1 year ago

I think this was fixed via https://github.com/11ty/eleventy-plugin-vite/commit/7cd0709dfaf5b5dda3ccb49146a840669acabcd9? Could be closed.

zachleat commented 1 year ago

Yes, thank you @KiwiKilian. This shipped with 2.0.0-canary.2 (stable version shipping today!)