vite-plugin-backend-full-bundle
v0.1.0
Published
Expose backend-friendly entry tags for Vite dev and Full Bundle Mode
Maintainers
Readme
Why? 🤔
Vite 8 announcement introduced Full Bundle Mode, which is very promising for backend integrations (Rails, Laravel, etc.).
In regular dev mode, backends usually inject source entry tags (/@vite/client + entry module). In Full Bundle Mode, Vite serves bundled HTML output from memory, so those assumptions no longer hold.
This plugin provides a backend-facing endpoint that returns the actual script/style/preload tags Vite resolves in dev, including bundled dev.
Related context: rolldown#9030.
Installation 💿
Install the package as a development dependency:
npm i -D vite-plugin-backend-full-bundleUsage 🚀
Add it to your plugins in vite.config.ts:
import { defineConfig } from 'vite'
import BackendFullBundle from 'vite-plugin-backend-full-bundle'
export default defineConfig({
plugins: [BackendFullBundle()],
})Then request:
GET /@vite-plugin-backend-full-bundle/entry-tags?entry=index.htmlExample response:
{
"entry": "index.html",
"tags": {
"scripts": [{ "src": "/@vite/client" }, { "src": "/main.ts" }],
"styles": [{ "href": "/style.css" }],
"preloads": []
}
}In Full Bundle Mode, tags come from bundled in-memory HTML output.
Configuration ⚙️
BackendFullBundle(options?)
endpoint?: string- Custom endpoint path.
- Default:
/@vite-plugin-backend-full-bundle/entry-tags
defaultEntry?: string- Fallback entry when
entryquery param is missing. - Default:
index.html
- Fallback entry when
License
This library is available as open source under the terms of the MIT License.
