vite-plugin-dynamic-base
v1.1.0
Published
Resolve all resource files dynamic publicPath, like Webpack's __webpack_public_path__
Downloads
15,772
Maintainers
Readme
vite-plugin-dynamic-base
- 🦾 Resolve all resource files dynamic publicPath, like Webpack's
__webpack_public_path__
.
Installation
npm i vite-plugin-dynamic-base -D
Changelog
Build Mode
- [x] es
- [x] system
Compatible plugins
Usage
// vite.config.ts
import { dynamicBase } from 'vite-plugin-dynamic-base'
export default defineConfig({
// base: "/",
base: process.env.NODE_ENV === "production" ? "/__dynamic_base__/" : "/",
plugins: [
dynamicBase({ /* options */ }),
],
})
Configuration
The following show the default values of the configuration
dynamicBase({
// dynamic public path var string, default window.__dynamic_base__
publicPath: 'window.__dynamic_base__',
// dynamic load resources on index.html, default false. maybe change default true
transformIndexHtml: false
// provide conversion configuration parameters. by 1.1.0
// transformIndexHtmlConfig: { insertBodyAfter: false }
})