vite-plugin-eslint4b
raw JSON → 0.8.0 verified Mon Apr 27 auth: no javascript
Vite plugin that allows ESLint to run in the browser by bundling ESLint with browser-compatible polyfills. v0.8.0 supports ESLint 8-10 and Vite >=4, Node >=20. Differentiates from other ESLint plugins by targeting browser environments for linting, not build-time checks. Ships ESM-only, uses rolldown as bundler. Notable for breaking changes: dropped Node 19 support in v0.8.0 and switched to rolldown in v0.6.0. Community-maintained by ota-meshi.
Common errors
error Error: [vite-plugin-eslint4b] Cannot find module 'eslint' ↓
cause Missing dependency 'eslint'
fix
Install eslint as devDependency: npm install --save-dev eslint
error Error: require() of ES Module not supported ↓
cause Using require() to import the plugin (ESM-only)
fix
Use import statement: import eslint4b from 'vite-plugin-eslint4b'
error NodeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature 'node:util' is not available ↓
cause Running Node.js <20 with plugin version >=0.8.0
fix
Upgrade Node.js to version 20 or later
Warnings
breaking v0.8.0 drops support for Node.js 19 and older ↓
fix Upgrade Node.js to version 20 or later
breaking v0.6.0 switched bundler from esbuild to rolldown ↓
fix Ensure compatibility with rolldown; report issues if unexpected behavior occurs
breaking v0.5.0 changed cwd path to '/' which may break ESLint rules relying on working directory ↓
fix Adapt rules to use absolute paths or handle '/' cwd
gotcha This plugin does NOT run ESLint during build; it allows ESLint imports in browser runtime ↓
fix Use for browser-based linting, not build-time checks
Install
npm install vite-plugin-eslint4b yarn add vite-plugin-eslint4b pnpm add vite-plugin-eslint4b Imports
- default wrong
const eslint4b = require('vite-plugin-eslint4b')correctimport eslint4b from 'vite-plugin-eslint4b' - default (CommonJS)
import eslint4b from 'vite-plugin-eslint4b'
Quickstart
// vite.config.ts
import type { UserConfig } from 'vite';
import eslint4b from 'vite-plugin-eslint4b';
export default {
plugins: [eslint4b()]
} as UserConfig;