@cside.dev/vite
v2.1.1
Published
Vite plugin for integrating cside
Readme
@cside.dev/vite
Integrate cside into your Vite project with ease.
Installation
# npm
npm i -D @cside.dev/vite
# yarn
yarn add -D @cside.dev/vite
# pnpm
pnpm i -D @cside.dev/viteMinimum release age
We recommend configuring a minimum release age so your package manager only installs versions that have been published for at least 7 days. Compromised package versions are typically detected and unpublished within days of publication, so a cooldown protects you from npm supply chain attacks. This applies to all your dependencies, not just this package.
# npm (.npmrc, in days)
min-release-age=7# yarn (.yarnrc.yml, as a duration string)
npmMinimalAgeGate: "7d"# pnpm (pnpm-workspace.yaml, in minutes)
minimumReleaseAge: 10080Usage
Add the plugin to your vite.config.ts:
import { defineConfig } from "vite";
import { cside } from "@cside.dev/vite";
export default defineConfig({
plugins: [
cside({
teamId: "your-team-id",
}),
],
});That's it. The plugin injects the cside script into your built index.html.
Options
| Option | Type | Default | Description |
| ------------- | --------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| teamId | string | — | Your cside team ID. Loads the script from https://{teamId}.csidetm.com/script.js. |
| fingerprint | boolean | false | Load the fingerprinting script instead of the default monitoring (tag manager) script. Swaps the domain from csidetm.com to csidefd.com. |
| enabled | boolean | true in build, false in dev | Force-enable or disable the plugin. By default it auto-disables during vite dev. |
cside({
teamId: "your-team-id",
enabled: true,
});To load the fingerprinting script:
cside({
teamId: "your-team-id",
fingerprint: true,
});If
teamIdis not provided, the plugin falls back to the default proxy script athttps://proxy.csidetm.com/script.js(orhttps://proxy.csidefd.com/script.jswhenfingerprintistrue).The previous
scriptUrlandproxyUrloptions are deprecated — useteamIdinstead.
How it works
During the transformIndexHtml step, the plugin prepends a <script> tag loading the cside script to <head>.
Documentation
See the cside docs for more.
