studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
20 lines (19 loc) • 865 B
TypeScript
import type { AstroIntegration } from 'astro';
export declare const resolveBuiltIns: (id: string) => {
id: string;
external: boolean;
} | undefined;
/**
* Creates an Astro integration that injects a Vite plugin to automatically
* resolve Node.js built-in modules using the `node:` protocol namespace.
*
* This integration ensures that imports of Node.js built-ins (e.g., 'fs', 'path')
* are rewritten to use the `node:` prefix and marked as external, preventing
* bundling and ensuring correct module resolution in Vite-powered Astro projects.
*
* The integration checks if the 'namespace-builtins' Vite plugin is already present
* before adding it, to avoid duplicate plugins.
*
* @returns {AstroIntegration} An Astro integration for handling Node.js built-in modules.
*/
export declare function nodeNamespaceBuiltinsAstro(): AstroIntegration;