1.1.0 • Published 22h ago
vite-inject-base-href
Licence
MIT
Version
1.1.0
Deps
0
Size
7 kB
Vulns
0
Weekly
0
Vite Inject <base href="/"> Plugin
A Vite plugin that automatically injects <base href="/"> at the end of the </head> tag
Installation
npm install vite-inject-base-href --save-dev
Usage
In your vite.config.js:
import injectBaseHref from 'vite-inject-base-href'
export default {
plugins: [
injectBaseHref(),
// OR injectBaseHref('/my-base'),
]
}
How it works
The plugin automatically injects <base href="/"> at the end of the </head> tag
If BASE_URL environment bariable is present, it will be used instead of /
License
MIT Roger Vilà