1 |
|
2 | import { ExternalsElement, Condition } from 'webpack';
|
3 | import * as IWebpackChainConfig from 'webpack-chain';
|
4 | import { ReactNode } from 'react';
|
5 | import { IChangeWebpackConfigFunc } from './index';
|
6 |
|
7 | export type IPlugin<T = any> = string | [string, T];
|
8 |
|
9 | export interface IRoute {
|
10 | path?: string;
|
11 | component?: ReactNode;
|
12 | routes?: IRoute[];
|
13 | Routes?: string[];
|
14 | redirect?: string;
|
15 | [key: string]: any;
|
16 | }
|
17 |
|
18 | export interface IExportStaticOpts {
|
19 | htmlSuffix?: boolean;
|
20 | dynamicRoot?: boolean;
|
21 | }
|
22 |
|
23 |
|
24 | export interface IAFWebpackConfig {
|
25 | alias?: object;
|
26 | autoprefixer?: object;
|
27 | babel?: object;
|
28 | browserslist?: string[];
|
29 | chainConfig?: any;
|
30 | copy?: any[];
|
31 | cssLoaderOptions?: any;
|
32 | cssModulesExcludes?: string[];
|
33 | cssModulesWithAffix?: boolean;
|
34 | cssnano?: object;
|
35 | cssPublicPath?: string;
|
36 | generateCssModulesTypings?: boolean;
|
37 | define?: object;
|
38 | devServer?: object;
|
39 | devtool?: string | false;
|
40 | disableCSSModules?: boolean;
|
41 | disableCSSSourceMap?: boolean;
|
42 | disableDynamicImport?: boolean;
|
43 | disableGlobalVariables?: boolean;
|
44 | cssLoaderVersion?: 1 | 2;
|
45 | entry?: any;
|
46 | env?: object;
|
47 | es5ImcompatibleVersions?: boolean;
|
48 | externals?: ExternalsElement;
|
49 | extraBabelIncludes?: Condition[];
|
50 | extraBabelPlugins?: any[];
|
51 | extraBabelPresets?: any[];
|
52 | extraPostCSSPlugins?: any[];
|
53 | hash?: boolean;
|
54 | ignoreMomentLocale?: boolean;
|
55 | lessLoaderOptions?: any;
|
56 | manifest?: any;
|
57 | minimizer?: 'uglifyjs' | 'terserjs';
|
58 | outputPath?: string;
|
59 | proxy?: object | [object, Function];
|
60 | publicPath?: string;
|
61 | sass?: object;
|
62 | terserJSOptions?: object;
|
63 | theme?: string | object;
|
64 | tsConfigFile?: string;
|
65 | typescript?: object;
|
66 | uglifyJSOptions?: object;
|
67 | urlLoaderExcludes?: Condition[];
|
68 | }
|
69 |
|
70 | type WhitelistOption = string | RegExp;
|
71 | export type IExportSSROpts =
|
72 | | {
|
73 |
|
74 | externalWhitelist?: WhitelistOption[];
|
75 |
|
76 | nodeExternalsOpts?: object;
|
77 |
|
78 | manifestFileName?: string;
|
79 |
|
80 | disableExternal?: boolean;
|
81 |
|
82 | disableExternalWhiteList?: string[] | object;
|
83 | }
|
84 | | boolean;
|
85 |
|
86 | export interface IMockOpts {
|
87 | exclude?: string[] | string;
|
88 | }
|
89 |
|
90 | interface IConfig extends IAFWebpackConfig {
|
91 |
|
92 |
|
93 | block?: object;
|
94 | chainWebpack?: IChangeWebpackConfigFunc<IWebpackChainConfig, IAFWebpackConfig>;
|
95 | context?: object;
|
96 | disableRedirectHoist?: boolean;
|
97 | exportStatic?: boolean | IExportStaticOpts;
|
98 | outputPath?: string;
|
99 | plugins?: IPlugin[];
|
100 | routes?: IRoute[] | null;
|
101 | runtimePublicPath?: boolean | string;
|
102 | singular?: boolean;
|
103 | mock?: IMockOpts;
|
104 | treeShaking?: boolean;
|
105 | dva?: any;
|
106 | locale?: any;
|
107 |
|
108 |
|
109 | base?: string;
|
110 | history?: 'browser' | 'hash' | 'memory';
|
111 | mountElementId?: string;
|
112 | targets?: {
|
113 | [key: string]: number;
|
114 | };
|
115 | ssr?: IExportSSROpts;
|
116 | }
|
117 |
|
118 | export default IConfig;
|