@dr.pogodin/react-utils
Version:
Collection of generic ReactJS components and utils
35 lines (34 loc) • 1.06 kB
TypeScript
import type { TransformOptions } from '@babel/core';
export interface BabelCompilerI {
env: () => string;
}
/**
* Supported Babel environments.
*/
export declare enum ENVIRONMENTS {
DEV = "development",
PROD = "production",
TEST = "test"
}
type ModuleT = 'amd' | 'auto' | 'cjs' | 'commonjs' | 'systemjs' | 'umd' | false;
export type OptionsT = {
modules?: ModuleT;
noRR?: boolean;
noStyling?: boolean;
targets?: string | string[] | Record<string, string>;
typescript?: boolean;
};
/**
* Generates Babel preset for Webpack.
* @param babel Babel compiler.
* @param [ops] Preset options.
* @param [ops.noRR] If truthy `react-refresh/babel` plugin is not
* included into config, no matter the environment.
* @param [ops.noStyling] If truthy all setup related to styling
* ((S)CSS processing) will be skipped.
* @param [ops.targets=defaults] Targets for
* `@babel/preset-env`.
* @return Generated config.
*/
export default function getPreset(babel: BabelCompilerI, ops?: OptionsT): TransformOptions;
export {};