fastify / fastify-vite

Fastify plugin for Vite integration.
MIT License
849 stars 71 forks source link

feat: make Vite configuration available from distribution bundle #156

Open onlywei opened 1 month ago

onlywei commented 1 month ago

Addresses #155

Adds a new config option that needs a vite plugin to work.

By default, @fastify/vite looks up the Vite configuration options by importing Vite from node_modules and then using its Node API to look up the vite.config file. This is often not desirable in production mode since many production builds declare Vite as a devDependency and exclude it from their final container/docker images to save space.

To support this kind of production build, this PR makes @fastify/vite ship with a Vite plugin that can save the handful of properties that it needs from the resolved Vite configuration object to a file in your dist directory. These properties can than be loaded instead of loading the config through vite itself.

See the changes to the docs/config/index.md file for exactly what is happening in this change.

Checklist

netlify[bot] commented 1 month ago

Deploy Preview for agitated-mahavira-26f8f9 canceled.

Name Link
Latest commit 0067f7ee587ab5ce1fbc871efb02d938189f8fe3
Latest deploy log https://app.netlify.com/sites/agitated-mahavira-26f8f9/deploys/66ce183a4d383300085eebf7
galvez commented 1 month ago

This is absolutely amazing, thank you @onlywei! I'll be reviewing shortly.