{"id":22662,"library":"vite-plugin-fathom","title":"vite-plugin-fathom","description":"A Vite plugin that injects the Fathom analytics script into HTML pages during build. Current stable version is 0.1.0. It is a lightweight, single-purpose plugin with peer dependency on Vite >= 6.0.0. It supports environment variable-based configuration via VITE_FATHOM_ID and advanced Fathom options like forceEU, spa, honorDNT, autoTrack, and ignoreCanonical. Differentiators: minimal setup, TypeScript type definitions included, and automatic script injection without manual template modification.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/robbevp/vite-plugin-fathom","tags":["javascript","vite","vite-plugin","fathom","typescript"],"install":[{"cmd":"npm install vite-plugin-fathom","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-fathom","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-fathom","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package exports a default function, not a named export.","wrong":"import { vitePluginFathom } from 'vite-plugin-fathom'","symbol":"default (vitePluginFathom)","correct":"import vitePluginFathom from 'vite-plugin-fathom'"},{"note":"FathomOptions is a TypeScript type, use import type to avoid runtime issues.","wrong":"import { FathomOptions } from 'vite-plugin-fathom'","symbol":"type FathomOptions","correct":"import type { FathomOptions } from 'vite-plugin-fathom'"},{"note":"The default export is a function, not a constructor.","wrong":"new vitePluginFathom()","symbol":"plugin call","correct":"vitePluginFathom()"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport vitePluginFathom from 'vite-plugin-fathom';\n\nexport default defineConfig({\n  plugins: [\n    vitePluginFathom(process.env.VITE_FATHOM_ID ?? '', {\n      forceEU: true,\n      spa: 'auto',\n      honorDNT: true,\n    }),\n  ],\n});","lang":"typescript","description":"Minimal Vite config integrating the Fathom plugin with environment variable and options."},"warnings":[{"fix":"Upgrade Vite to 6.0.0 or later: npm install vite@^6.0.0","message":"Requires Vite version >= 6.0.0. Older Vite versions will fail to load the plugin.","severity":"breaking","affected_versions":"0.1.0"},{"fix":"Set VITE_FATHOM_ID in .env file or pass site ID as first argument.","message":"Environment variable VITE_FATHOM_ID must be set (or pass site ID explicitly) otherwise the plugin will throw.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure if you need custom options, pass them as second argument.","message":"Options object is optional; if omitted, defaults to empty object.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Set VITE_FATHOM_ID=YOUR_SITE_ID or call vitePluginFathom('YOUR_SITE_ID').","cause":"No site ID provided and env var not set.","error":"Error: The Fathom site ID must be provided via the VITE_FATHOM_ID environment variable or as the first argument."},{"fix":"Use import vitePluginFathom from 'vite-plugin-fathom' instead of destructured import.","cause":"Importing as named export instead of default import.","error":"TypeError: vitePluginFathom is not a function"},{"fix":"Upgrade Vite to version 6 or later using npm install vite@^6.","cause":"Vite version below 6.0.0.","error":"Error: Vite 6 is required for this plugin"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}