{"id":22592,"library":"vite-plugin-biome","title":"vite-plugin-biome","description":"vite-plugin-biome (v1.2.0) integrates Biome linting, formatting, and checking into the Vite dev server loop. It runs on startup and on hot module replacements, providing immediate feedback during development without separate CLI steps. Supports Biome >=1.8.0 and Vite >=4.x. Key differentiators: automatic fix application, configurable hot update modes (full or changed-only), build-fail-on-error, and extra Biome CLI argument passthrough. Ships TypeScript types.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/skrulling/vite-plugin-biome","tags":["javascript","biome","biomejs","vite","vite-plugin","linter","linting","formatter","formatting","typescript"],"install":[{"cmd":"npm install vite-plugin-biome","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-biome","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-biome","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: Biome binary used for linting/formatting/checking.","package":"@biomejs/biome","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require() fails. Use dynamic import() if needed in CJS context.","wrong":"const biomePlugin = require('vite-plugin-biome')","symbol":"default","correct":"import biomePlugin from 'vite-plugin-biome'"},{"note":"The package exports a single default function, not a named export.","wrong":"import { biomePlugin } from 'vite-plugin-biome'","symbol":"default","correct":"import biomePlugin from 'vite-plugin-biome'"},{"note":"Options interface is exported as a type; use `import type` in TypeScript to avoid runtime errors.","wrong":"import { Options } from 'vite-plugin-biome'","symbol":"type Options","correct":"import type { Options } from 'vite-plugin-biome'"},{"note":"In CJS, use dynamic import() and take .default. Direct require() throws ERR_REQUIRE_ESM.","wrong":"const biomePlugin = require('vite-plugin-biome')","symbol":"default (require)","correct":"const biomePlugin = (await import('vite-plugin-biome')).default"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport biomePlugin from 'vite-plugin-biome';\n\nexport default defineConfig({\n  plugins: [\n    biomePlugin({\n      mode: 'check',\n      files: 'src/**/*.{js,ts,jsx,tsx}',\n      applyFixes: true,\n      failOnError: false,\n    }),\n  ],\n});\n\n// Then install peer deps:\n// npm install -D vite-plugin-biome @biomejs/biome","lang":"typescript","description":"Minimal Vite config enabling Biome check with auto-fix on all source files during dev."},"warnings":[{"fix":"Use `import biomePlugin from 'vite-plugin-biome'`.","message":"Default import is the only export; named import like `import { biomePlugin }` will import `undefined`.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use dynamic `import()` or switch to ESM in your project (e.g., type: 'module' in package.json).","message":"Plugin is ESM-only; using `require('vite-plugin-biome')` throws ERR_REQUIRE_ESM.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Install @biomejs/biome@^1.8.0 as a devDependency.","message":"Peer dependency @biomejs/biome must be >=1.8.0; older Biome versions cause runtime errors or missing commands.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use `failOnError: true` only for production builds (e.g., VITE_BUILD_MODE env check) to avoid blocking dev server.","message":"Setting `failOnError: true` may cause unexpected build failures during development if Biome reports warnings or formatting issues.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Accept startup behavior; if you need to avoid startup scan, configure `files` selectively (e.g., `files: 'src'`).","message":"`hotUpdateMode: 'changed'` still runs a full startup scan; only HMR triggers are scoped to changed files. Expect full scan on dev start.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `import biomePlugin from 'vite-plugin-biome'` (ESM) or dynamic `import()` in CJS: `const biomePlugin = (await import('vite-plugin-biome')).default;`","cause":"Using CommonJS require() on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/vite-plugin-biome/dist/index.mjs not supported."},{"fix":"Use `import biomePlugin from 'vite-plugin-biome'` (default import).","cause":"Imported named export `{ biomePlugin }` instead of default.","error":"TypeError: biomePlugin is not a function"},{"fix":"Run `npm install -D @biomejs/biome` or `yarn add -D @biomejs/biome`.","cause":"Missing required peer dependency @biomejs/biome.","error":"Error: Could not resolve '@biomejs/biome' (peer dependency)"},{"fix":"Check Biome config (e.g., `biome.json`) for invalid rules or file exclusions. Run `npx biome format --write .` to test standalone.","cause":"Biome encountered a formatting error or misconfiguration in biome.json.","error":"Error: Biome command 'format' failed: exit code 1"},{"fix":"Upgrade @biomejs/biome to >=1.9.0 or remove `--changed` from `biomeAdditionalArgs`.","cause":"Using --changed flag with Biome <1.9.0 which does not support it.","error":"Error: Unknown argument: --changed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}