{"id":22904,"library":"vite-plugin-vanjs","title":"vite-plugin-vanjs","description":"vite-plugin-vanjs (v0.1.18) is a meta-framework for VanJS built on Vite, providing routing, JSX support, SSR/SSG, and isomorphic modules. Released with weekly updates, it integrates router, meta management, JSX transformation, and server/client helpers. Key differentiators: zero-config hydration, lazy route loading with async unification since v0.1.17, and automatic van.debug.js in dev mode. Requires node >=20, pnpm >=8.6.0, and peer deps csstype, mini-van-plate, vanjs-core, vanjs-ext.","status":"active","version":"0.1.18","language":"javascript","source_language":"en","source_url":"https://github.com/thednp/vite-plugin-vanjs","tags":["javascript","vanjs","vite","plugin","router","meta","ssr","ssg","jsx","typescript"],"install":[{"cmd":"npm install vite-plugin-vanjs","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-vanjs","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-vanjs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"TypeScript types for CSS","package":"csstype","optional":true},{"reason":"Server-side VanJS rendering","package":"mini-van-plate","optional":false},{"reason":"Core VanJS library","package":"vanjs-core","optional":false},{"reason":"VanJS extensions","package":"vanjs-ext","optional":false}],"imports":[{"note":"ESM-only package; requires Vite config ESM.","wrong":"const vitePluginVanjs = require('vite-plugin-vanjs')","symbol":"vitePluginVanjs","correct":"import { vitePluginVanjs } from 'vite-plugin-vanjs'"},{"note":"Router is a separate subpath export; default export is the plugin.","wrong":"import { router } from 'vite-plugin-vanjs'","symbol":"router","correct":"import { router } from 'vite-plugin-vanjs/router'"},{"note":"Since v0.1.17, lazy() is async on both server and client.","wrong":"const lazy = require('vite-plugin-vanjs/router').lazy","symbol":"lazy","correct":"import { lazy } from 'vite-plugin-vanjs/router'"}],"quickstart":{"code":"// vite.config.js\nimport { defineConfig } from 'vite';\nimport { vitePluginVanjs } from 'vite-plugin-vanjs';\n\nexport default defineConfig({\n  plugins: [vitePluginVanjs()]\n});\n\n// pages/index.js\nimport { lazy, router } from 'vite-plugin-vanjs/router';\nimport van from 'vanjs-core';\n\nconst Home = () => van.tags.div('Hello from VanJS!');\nconst routes = {\n  '/': Home,\n  '/about': lazy(() => import('./pages/About'))\n};\n\nconst app = document.getElementById('app');\nrouter(app, routes);","lang":"javascript","description":"Basic setup: Vite config with the plugin, then use the router with lazy-loaded routes."},"warnings":[{"fix":"Update lazy() calls to handle async functions; previously client returned synchronous van.state.","message":"lazy() changed to async on both server and client in v0.1.17","severity":"breaking","affected_versions":">=0.1.17"},{"fix":"Change executeLifecycle(route, params) to match new signature (route, params).","message":"executeLifecycle() signature changed in v0.1.17","severity":"breaking","affected_versions":">=0.1.17"},{"fix":"Use separate import for Script and Style from @vanjs/meta or handle manually.","message":"Script and Style removed from Meta module in v0.1.15","severity":"deprecated","affected_versions":">=0.1.15"},{"fix":"Disable van.debug.js or avoid JSX in development; plugin auto-loads van.debug.js in dev mode.","message":"JSX transformation incompatible with van.debug.js in dev mode","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Check Node.js version with `node --version` and pnpm with `pnpm --version`; upgrade if needed.","message":"requires node >=20 and pnpm >=8.6.0","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":"Ensure you use import { router } from 'vite-plugin-vanjs/router' (no default export).","cause":"Missing subpath export or incorrect import path.","error":"Cannot find module 'vite-plugin-vanjs/router'"},{"fix":"Update to v0.1.17+ and import { lazy } from 'vite-plugin-vanjs/router'.","cause":"Using older version (<0.1.17) or incorrect import.","error":"lazy is not a function"},{"fix":"Install vanjs-core and import van before using tags.","cause":"vanjs-core not installed or not imported.","error":"Uncaught TypeError: van.tags is undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}