A small plugin to add Splitbee support to Vite
Install the dependency
npm install --save-dev vite-plugin-splitbee # yarn add -D vite-plugin-splitbee
Add it to your Vite config
// vite.config.ts
import Splitbee from 'vite-plugin-splitbee';
export default {
plugins: [
Splitbee(),
]
}
export default {
plugins: [
Splitbee({
/// Provide a custom API url to use instead of the default Splitbee one (Optional) [Default: 'https://hive.splitbee.io']
api_url: string,
/// When using A/B testing, you can prevent the initial content flash by making the script blocking/synchronous (Optional) [Default: false]
async: boolean,
/// Whether to include Splitbee analytics during local development (Optional) [Default: false]
dev: boolean,
/// Whether to enable cookie-less mode (Optional) [Default: false]
disable_cookie: boolean,
/// To use Splitbee on another subdomain you can provide a project token. This can be found in project settings (Optional)
token: string,
/// URL to Splitbee script to load (Optional) [Default: 'https://cdn.splitbee.io/sb.js']
url: string,
}),
],
}
Currently this plugin only supports Vite 2.x