Saltearse al contenido

loader

Esta página aún no está disponible en tu idioma.

function bundleConfigFile(__namedParameters: {
fileUrl: URL;
}): Promise<{
code: any;
dependencies: string[];
}>

Defined in: loader.ts:18^

Bundle arbitrary mjs or ts file. Simplified fork from Vite’s bundleConfigFile function.

URL

Promise<{ code: any; dependencies: string[]; }>

https://github.com/vitejs/vite/blob/main/packages/vite/src/node/config.ts#L961^


function importBundledFile(__namedParameters: ImportBundledFileArgs): Promise<{
default: unknown;
}>

Defined in: loader.ts:49^

Forked from Vite config loader, replacing CJS-based path concat with ESM only

ImportBundledFileArgs

Promise<{ default: unknown; }>

https://github.com/vitejs/vite/blob/main/packages/vite/src/node/config.ts#L1074^


function loadAndBundleConfigFile(params: LoadAndBundleConfigFileArgs): Promise<LoadAndBundleConfigFileResult>

Defined in: loader.ts:77^

Loads and bundles a configuration file, then imports the bundled module.

LoadAndBundleConfigFileArgs

The arguments for loading and bundling the config file.

Promise<LoadAndBundleConfigFileResult>

A promise that resolves to an object containing the imported module (mod) and an array of its dependencies.


function loadConfigFile<R>(
root: URL,
configPaths: string[],
label?: string): Promise<undefined | R>

Defined in: loader.ts:113^

Loads a configuration file from a list of possible paths relative to a given root URL.

Iterates through the provided configPaths, checking for the existence of each file. If a file is found, it is loaded and bundled, and its default export is returned as the configuration object. If no valid configuration file is found, or if the file does not have a valid default export, the function returns undefined or throws an error, respectively.

R

The expected shape of the configuration object.

URL

The base URL to resolve configuration file paths against.

string[]

An array of possible configuration file paths to check, relative to root.

string

Promise<undefined | R>

A promise that resolves to the configuration object of type R, or undefined if no valid config file is found.

If a config file is found but does not have a valid default export.