{"id":22793,"library":"vite-plugin-pug","title":"vite-plugin-pug","description":"Vite plugin that transforms <pug> tags in HTML into compiled Pug templates. Current stable version is 0.4.1, supporting Vite 5. Releases follow no strict cadence; last update (v0.4.1) added Vite 5 support. Key differentiators: supports local variables, multiple pug tags, self-closing tags, hot reload on save, and works with both CJS and ESM. Ships TypeScript declarations. Simpler than alternatives that require Vue SFCs for Pug support.","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/SubZtep/vite-plugin-pug","tags":["javascript","vite","vite-plugin","pug","jade","typescript"],"install":[{"cmd":"npm install vite-plugin-pug","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-pug","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-pug","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Pug compiler required at runtime","package":"pug","optional":false}],"imports":[{"note":"ESM-only; CJS require works but not recommended since v0.3.1 ships ESM only.","wrong":"const pugPlugin = require('vite-plugin-pug')","symbol":"default (pugPlugin)","correct":"import pugPlugin from 'vite-plugin-pug'"},{"note":"The package exports a default function, not a named export.","wrong":"import { pugPlugin } from 'vite-plugin-pug'","symbol":"default (pugPlugin)","correct":"import pugPlugin from 'vite-plugin-pug'"},{"note":"TypeScript users can import the PluginOptions type for better intellisense.","wrong":"","symbol":"Type (PluginOptions)","correct":"import type { PluginOptions } from 'vite-plugin-pug'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite'\nimport pugPlugin from 'vite-plugin-pug'\n\nconst options = { pretty: true, basedir: process.cwd() }\nconst locals = { name: 'World' }\n\nexport default defineConfig({\n  plugins: [pugPlugin(options, locals)],\n})","lang":"typescript","description":"Configures Vite to use vite-plugin-pug with Pug pretty-printing option and local variables."},"warnings":[{"fix":"Remove `pretty` from plugin options, or use pug's built-in formatting via beautifier.","message":"Pug option `pretty` is deprecated in Pug 3 and will be removed.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Update config: `pugPlugin(options, locals)` instead of `pugPlugin({locals, ...})`.","message":"v0.3.0 changed to only accept `options` (pug options) and `locals` (data) as separate parameters, rather than a single object.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Ensure all pug src paths are relative to the importing HTML file.","message":"Local imports (`localImports` option) only work when the pug `src` attribute is a relative path. Does not support absolute paths or module resolution.","severity":"gotcha","affected_versions":">=0.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install -D pug` to add the peer dependency.","cause":"Pug template compilation failed, often due to missing pug dependency.","error":"Error: The service you have requested is not available yet."},{"fix":"Use `import pugPlugin from 'vite-plugin-pug'` (no curly braces).","cause":"Named import used instead of default import.","error":"TypeError: pugPlugin is not a function"},{"fix":"Run `npm install -D vite-plugin-pug`.","cause":"Plugin not installed or not in node_modules.","error":"[vite] Internal server error: Cannot find module 'vite-plugin-pug'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}