Registry / devops / vitefu

vitefu

JSON →
library1.1.3jsnpmunverified

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.

npm install vitefu
INSTALL
IMPORT
SIG · VITEFU
V
vitefu
devopsjavascriptv1.1.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

crawlFrameworkPkgs
import { crawlFrameworkPkgs } from 'vitefu'
import crawlFrameworkPkgs from 'vitefu'
Named export; default export does not exist. Works in both ESM and CJS.
isDepExternaled
import { isDepExternaled } from 'vitefu'
const isDepExternaled = require('vitefu').isDepExternaled
CJS require is deprecated; use ESM imports. Named export only.
findDepPkgJsonPath
import { findDepPkgJsonPath } from 'vitefu'
import { findAllPkgJsonPaths } from 'vitefu'
Function name is findDepPkgJsonPath, not findAllPkgJsonPaths. Use named import.

Demonstrates using crawlFrameworkPkgs to include framework dependencies for optimization and SSR externalization in a Vite config.

import { crawlFrameworkPkgs } from 'vitefu'; import { defineConfig } from 'vite'; export default defineConfig({ optimizeDeps: { include: [], }, ssr: { external: [], }, async configResolved(config) { const { optimizedDeps, ssr } = await crawlFrameworkPkgs({ root: __dirname, viteConfig: config, frameworkPkg: 'my-framework', }); config.optimizeDeps.include = optimizedDeps; config.ssr.external = ssr.external; }, });
Debug
Known issues
gotchacrawlFrameworkPkgs result arrays are sorted deterministically only since v1.1.3; earlier versions may produce non-deterministic order.
fix
Upgrade to v1.1.3 or later, or sort arrays manually.
affects: <1.1.3
gotchaworkspaceRoot option in crawlFrameworkPkgs introduced in v1.1.0; it enables crawling devDependencies of local workspace private packages, but may require proper workspace configuration.
fix
Ensure workspaceRoot points to the root of your monorepo and that private packages have package.json with devDependencies.
affects: >=1.1.0
gotchaisDepExternaled may not handle ssr.external: true (boolean) correctly before v1.0.6; it expects an array of strings.
fix
Upgrade to v1.0.6 or later, or convert boolean ssr.external to array manually.
affects: <1.0.6
breakingv1.0.0 removed top-level await to allow future compatibility with require() of ESM code. If you depend on top-level await, this breaks.
fix
Wrap initialization in async function if you need top-level await.
affects: >=1.0.0
gotchafindDepPkgJsonPath implementation changed in v0.2.5 to align with Vite; older versions may return inconsistent paths compared to Vite's own resolution.
fix
Upgrade to v0.2.5 or later.
affects: <0.2.5
Errors
Common errors & fixes
TypeError: Cannot destructure property 'optimizedDeps' of (intermediate value) as it is undefined.
crawlFrameworkPkgs called before Vite config is resolved (e.g., in config instead of configResolved hook).
fix
Move the call inside the 'configResolved' hook as shown in the quickstart.
Error: Failed to crawl framework packages: ENOENT: no such file or directory, open '.../package.json'.
crawlFrameworkPkgs expects a package.json at the root; before v1.0.6, missing package.json caused an error.
fix
Upgrade to v1.0.6+ which gracefully handles missing package.json, or ensure root has a package.json.
Module not found: Can't resolve 'vitefu'
vitefu is not installed or not in node_modules.
fix
Run npm install vitefu (or yarn/pnpm add vitefu). It requires Vite as a peer dependency.
Upgrade
Version history
1.1.3latest on npm
Audit
Dependencies
viterequiredPeer dependency; all utilities rely on Vite's internal APIs for dependency crawling and externalization checks.
Agent activity
6 hits · last 30 days
node
6
Resources
vitefu — npm install vitefu · libregistry