{"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,"search_vec":"'0.1.0':23 '6.0.0':37 'advanc':50 'analyt':12 'automat':68 'autotrack':57 'base':43 'build':18 'configur':44 'current':19 'definit':65 'depend':34 'differenti':60 'environ':40 'fathom':4,11,47,51,80 'forceeu':54 'honordnt':56 'html':15 'id':48 'ignorecanon':59 'includ':66 'inject':9,70 'javascript':75 'lightweight':27 'like':53 'manual':72 'minim':61 'modif':74 'option':52 'page':16 'peer':33 'plugin':3,7,31,79 'purpos':30 'script':13,69 'setup':62 'singl':29 'single-purpos':28 'spa':55 'stabl':20 'support':39 'templat':73 'type':64 'typescript':63,81 'variabl':42 'variable-bas':41 'version':21 'via':45 'vite':2,6,36,46,76,78 'vite-plugin':77 'vite-plugin-fathom':1 'without':71","created_at":"2026-04-27T17:06:20.997521+00:00","updated_at":"2026-04-27T17:06:20.997521+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/robbevp/vite-plugin-fathom","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-fathom","openapi_spec":null,"status_page":null,"smithery":null,"categories":["observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}