vite-plugin-require-transform
Version:
A plugin for vite that convert from require syntax to import that compat for es module.
18 lines (16 loc) • 577 B
TypeScript
type VitePluginRequireTransformParamsType = {
/** Filter files that should enter the plugin */
fileRegex?: RegExp;
/** Prefix for created import variable names */
importPrefix?: string;
/** Function to convert the require path to the import variable name */
importPathHandler?: Function;
};
declare function vitePluginRequireTransform(params?: VitePluginRequireTransformParamsType): {
name: string;
transform(code: string, id: string): Promise<{
code: any;
map: any;
}>;
};
export { vitePluginRequireTransform as default };