@uiw-admin/config
Version:
66 lines (65 loc) • 2.52 kB
TypeScript
import webpack from 'webpack';
import { LoaderConfOptions, WebpackConfiguration } from 'kkt';
export * from 'kkt';
export type DefaultDefineType = {
/** 权限校验 默认 true */
AUTH?: string | boolean;
/** 路由 跳转前缀 默认 "/" */
BASE_NAME?: string;
/** 本地存储使用 localStorage 还是 sessionStorage */
STORAGE?: 'local' | 'session' | string;
/** 版本 */
VERSION?: string;
/** token 存储方式 */
TOKEN_STORAGE?: 'local' | 'session' | 'cookie' | string;
/** token 存储字段 ,默认 token **/
TOKEN_NAME?: string;
/** 菜单搜索 **/
SEARCH_MENU?: string | boolean;
};
/** 全局默认公共参数 */
export declare const defaultDefine: DefaultDefineType;
export type ConfFun = (conf: WebpackConfiguration, evn: string, options?: LoaderConfOptions | undefined) => WebpackConfiguration;
export type PluginsType = (((this: webpack.Compiler, compiler: webpack.Compiler) => void) | webpack.WebpackPluginInstance | [string, Record<string, any>] | string)[];
export type KKTPlugins = (ConfFun | {
loader?: ConfFun;
options?: LoaderConfOptions | undefined | Record<string, any>;
} | string | [string, Record<string, any>])[];
export interface ConfigProps extends Omit<WebpackConfiguration, 'plugins'> {
/**
* 别名
* 默认系统内置两个别名
* 1. `@` 指向 src 目录
* 2. `@@` 指向 src/.uiw 目录
*/
alias?: Record<string, string | false | string[]>;
/** 插件 */
plugins?: PluginsType;
/** 默认全局变量 define , 注意:对象的属性值会经过一次 JSON.stringify 转换 */
define?: Record<string, any> & DefaultDefineType;
/**
* kkt plugin
* @deprecated 推荐使用 `kktPlugins`
*/
loader?: KKTPlugins;
/** kkt plugin */
kktPlugins?: KKTPlugins;
/** 项目前缀 */
publicPath?: string;
/**
* 提供回调函数,更改 webpack 的最终配置。
* @deprecated 推荐使用 `overrideWebpackConf`
*/
moreConfig?: ConfFun;
/** 提供回调函数,更改 webpack 的最终配置。 */
overrideWebpack?: ConfFun;
/** 输出 */
output?: Omit<WebpackConfiguration['output'], 'publicPath'>;
/** rematch 配置 */
rematch?: {
/** 懒加载 */
lazyLoad?: boolean;
};
}
declare const _default: (props: ConfigProps) => (conf: WebpackConfiguration, env: string, options: LoaderConfOptions) => WebpackConfiguration;
export default _default;