Vite bundler for Nuxt applications providing seamless integration between Nuxt's framework and Vite's build system
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Client and server manifest generation for optimal asset loading and bundle resolution in both development and production environments.
Generates and writes client and server manifests for bundle resolution and optimal asset loading.
/**
* Write client and server manifests for bundle resolution
* Creates manifests for optimal asset loading and bundle resolution
* @param ctx - Vite build context containing build information
*/
function writeManifest(ctx: ViteBuildContext): Promise<void>;Usage Example:
import { writeManifest } from "@nuxt/vite-builder/manifest";
import type { ViteBuildContext } from "@nuxt/vite-builder";
// Called automatically after server build completion
await writeManifest(ctx);
// Generates:
// - Client manifest for asset resolution
// - Server manifest for SSR bundle loading
// - Development manifests for hot reloadingClient-side manifest for browser asset loading and module resolution.
/**
* Client manifest structure for asset resolution
* Maps module IDs to their corresponding assets and metadata
*/
interface ClientManifest {
[moduleId: string]: {
/** Whether this is an entry point module */
isEntry: boolean;
/** File path relative to build output */
file: string;
/** Associated CSS files */
css?: string[];
/** Associated asset files */
assets?: string[];
/** Whether module uses ES modules */
module?: boolean;
/** Resource type (script, style, etc.) */
resourceType: 'script' | 'style' | 'font' | 'image';
};
}Client Manifest Features:
Special manifest structure for development mode with hot module replacement support.
/**
* Development client manifest for HMR support
* Simplified manifest structure for development builds
*/
interface DevClientManifest {
'@vite/client': {
isEntry: true;
file: '@vite/client';
css: string[];
module: true;
resourceType: 'script';
};
[entryPath: string]: {
isEntry: true;
file: string;
module: true;
resourceType: 'script';
};
}Development Features:
Optimized manifest for production builds with asset fingerprinting and optimization.
// Production manifest example
{
"entry": {
"isEntry": true,
"file": "entry.a1b2c3d4.js",
"css": ["assets/entry.e5f6g7h8.css"],
"assets": ["assets/logo.i9j0k1l2.png"],
"module": true,
"resourceType": "script"
},
"components/Header.vue": {
"isEntry": false,
"file": "assets/Header.m3n4o5p6.js",
"css": ["assets/Header.q7r8s9t0.css"],
"module": true,
"resourceType": "script"
}
}Sophisticated asset path processing for different deployment environments.
/**
* Asset path processing configuration
*/
interface AssetPathConfig {
/** Build assets directory */
buildAssetsDir: string;
/** Base URL for assets */
baseURL: string;
/** Whether to use relative paths */
relative?: boolean;
}Path Processing Features:
Normalizes Vite's raw manifest format for use with vue-bundle-renderer.
/**
* Normalize Vite manifest for vue-bundle-renderer
* Converts Vite's manifest format to vue-bundle-renderer format
* @param manifest - Raw Vite manifest
* @returns Normalized manifest for rendering
*/
function normalizeViteManifest(manifest: ViteClientManifest): RendererManifest;
/**
* Vue bundle renderer manifest format
*/
interface RendererManifest {
[moduleId: string]: {
isEntry: boolean;
file: string;
css: string[];
assets?: string[];
module?: boolean;
resourceType: string;
};
}Manages manifest files across different build directories and environments.
Directory Structure:
.nuxt/
├── dist/
│ ├── client/
│ │ ├── manifest.json # Client manifest
│ │ ├── entry.js # Entry point
│ │ └── assets/ # Static assets
│ └── server/
│ ├── server.mjs # Server entry
│ └── manifest.json # Server manifest (if needed)Special handling for server-side rendering manifest requirements.
/**
* SSR manifest configuration
*/
interface SSRManifestConfig {
/** Whether SSR is enabled */
ssr: boolean;
/** Server manifest path */
serverManifest?: string;
/** Client manifest path */
clientManifest: string;
}SSR Features:
Advanced asset handling and optimization within manifest generation.
Optimization Features:
Utility functions for working with manifests in different contexts.
/**
* Sanitize file path for cross-platform compatibility
* @param path - File path to sanitize
* @returns Sanitized file path
*/
function sanitizeFilePath(path: string): string;
/**
* Get filename from path without extension
* @param path - File path
* @returns Filename without extension
*/
function filename(path: string): string;
/**
* Resolve asset file names with hash patterns
* @param chunk - Rollup chunk information
* @returns Formatted asset filename
*/
function resolveAssetFileName(chunk: RenderedChunk): string;Comprehensive error handling for manifest generation failures.
Error Scenarios:
Manifest generation adapts to different build modes with appropriate optimizations.
Development Mode:
Production Mode:
Seamless integration with vue-bundle-renderer for optimal SSR performance.
Integration Features:
Install with Tessl CLI
npx tessl i tessl/npm-nuxt--vite-builder