{"id":20691,"library":"vitefu","title":"vitefu","description":"vitefu provides utilities for building frameworks with Vite, including `crawlFrameworkPkgs` to scan dependencies and `isDepExternaled` to check externalization status. Current stable version is 1.1.3, released in March 2025. It supports Vite 3–8 as peer dependencies and is updated regularly (multiple releases per year). Key differentiators: wraps Vite's internal logic for framework authors, handles workspace crawling, and is used by SvelteKit and Astro. It ships TypeScript types and ESM/CJS exports.","status":"active","version":"1.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/svitejs/vitefu","tags":["javascript","vite","framework","utilities","typescript"],"install":[{"cmd":"npm install vitefu","lang":"bash","label":"npm"},{"cmd":"yarn add vitefu","lang":"bash","label":"yarn"},{"cmd":"pnpm add vitefu","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; all utilities rely on Vite's internal APIs for dependency crawling and externalization checks.","package":"vite","optional":false}],"imports":[{"note":"Named export; default export does not exist. Works in both ESM and CJS.","wrong":"import crawlFrameworkPkgs from 'vitefu'","symbol":"crawlFrameworkPkgs","correct":"import { crawlFrameworkPkgs } from 'vitefu'"},{"note":"CJS require is deprecated; use ESM imports. Named export only.","wrong":"const isDepExternaled = require('vitefu').isDepExternaled","symbol":"isDepExternaled","correct":"import { isDepExternaled } from 'vitefu'"},{"note":"Function name is findDepPkgJsonPath, not findAllPkgJsonPaths. Use named import.","wrong":"import { findAllPkgJsonPaths } from 'vitefu'","symbol":"findDepPkgJsonPath","correct":"import { findDepPkgJsonPath } from 'vitefu'"}],"quickstart":{"code":"import { crawlFrameworkPkgs } from 'vitefu';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  optimizeDeps: {\n    include: [],\n  },\n  ssr: {\n    external: [],\n  },\n  async configResolved(config) {\n    const { optimizedDeps, ssr } = await crawlFrameworkPkgs({\n      root: __dirname,\n      viteConfig: config,\n      frameworkPkg: 'my-framework',\n    });\n    config.optimizeDeps.include = optimizedDeps;\n    config.ssr.external = ssr.external;\n  },\n});","lang":"typescript","description":"Demonstrates using crawlFrameworkPkgs to include framework dependencies for optimization and SSR externalization in a Vite config."},"warnings":[{"fix":"Upgrade to v1.1.3 or later, or sort arrays manually.","message":"crawlFrameworkPkgs result arrays are sorted deterministically only since v1.1.3; earlier versions may produce non-deterministic order.","severity":"gotcha","affected_versions":"<1.1.3"},{"fix":"Ensure workspaceRoot points to the root of your monorepo and that private packages have package.json with devDependencies.","message":"workspaceRoot option in crawlFrameworkPkgs introduced in v1.1.0; it enables crawling devDependencies of local workspace private packages, but may require proper workspace configuration.","severity":"gotcha","affected_versions":">=1.1.0"},{"fix":"Upgrade to v1.0.6 or later, or convert boolean ssr.external to array manually.","message":"isDepExternaled may not handle ssr.external: true (boolean) correctly before v1.0.6; it expects an array of strings.","severity":"gotcha","affected_versions":"<1.0.6"},{"fix":"Wrap initialization in async function if you need top-level await.","message":"v1.0.0 removed top-level await to allow future compatibility with require() of ESM code. If you depend on top-level await, this breaks.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade to v0.2.5 or later.","message":"findDepPkgJsonPath implementation changed in v0.2.5 to align with Vite; older versions may return inconsistent paths compared to Vite's own resolution.","severity":"gotcha","affected_versions":"<0.2.5"}],"env_vars":null,"search_vec":"'1.1.3':25 '2025':29 '3':33 '8':34 'astro':65 'author':55 'build':6 'check':18 'crawl':58 'crawlframeworkpkg':11 'current':21 'depend':14,37 'differenti':47 'esm/cjs':71 'export':72 'extern':19 'framework':7,54,75 'handl':56 'includ':10 'intern':51 'isdepextern':16 'javascript':73 'key':46 'logic':52 'march':28 'multipl':42 'peer':36 'per':44 'provid':3 'regular':41 'releas':26,43 'scan':13 'ship':67 'stabl':22 'status':20 'support':31 'sveltekit':63 'type':69 'typescript':68,77 'updat':40 'use':61 'util':4,76 'version':23 'vite':9,32,49,74 'vitefu':1,2 'workspac':57 'wrap':48 'year':45","created_at":"2026-04-25T11:24:27.731530+00:00","updated_at":"2026-04-25T11:24:27.731530+00:00","problems":[{"fix":"Move the call inside the 'configResolved' hook as shown in the quickstart.","cause":"crawlFrameworkPkgs called before Vite config is resolved (e.g., in config instead of configResolved hook).","error":"TypeError: Cannot destructure property 'optimizedDeps' of (intermediate value) as it is undefined."},{"fix":"Upgrade to v1.0.6+ which gracefully handles missing package.json, or ensure root has a package.json.","cause":"crawlFrameworkPkgs expects a package.json at the root; before v1.0.6, missing package.json caused an error.","error":"Error: Failed to crawl framework packages: ENOENT: no such file or directory, open '.../package.json'."},{"fix":"Run npm install vitefu (or yarn/pnpm add vitefu). It requires Vite as a peer dependency.","cause":"vitefu is not installed or not in node_modules.","error":"Module not found: Can't resolve 'vitefu'"}],"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/svitejs/vitefu","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vitefu","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}