-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinterface.ts
87 lines (79 loc) · 2.79 KB
/
interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import webpack from "webpack"
import { Application } from 'express';
import { MockerOption } from "mocker-api"
export type Paths = {
dotenv: string;
appPath: string;
appBuild: string;
appPublic: string;
appHtml: string;
appIndexJs: string;
appPackageJson: string;
/** App Root Path */
appSrc: string;
appTsConfig: string;
appJsConfig: string;
yarnLockFile: string;
testsSetup: string;
proxySetup: string;
appNodeModules: string;
swSrc: string;
publicUrlOrPath: string;
// These properties only exist before ejecting:
ownPath: string;
ownNodeModules: string;
appTypeDeclarations: string;
ownTypeDeclarations: string;
moduleFileExtensions?: string[]
};
export type Options = Omit<OverridesProps, "overridesClientWebpack" | "overridesServerWebpack" | "overridesCommonWebpack" | "overridesWebpack"> & OptionsProps
export type WebpackConfigFunction = (conf: webpack.Configuration[], env: "development" | "production", options: Options) => webpack.Configuration[] | webpack.Configuration;
export interface OverridesProps {
env?: Record<string, string>,
/** 是否使用原始 react-script 下的配置 **/
isUseOriginalConfig?: boolean;
/** 是否使用 server 配置 **/
isUseServerConfig?: boolean;
/** paths 脚本中webpack配置 使用的地址 */
paths?: Partial<Paths>;
/** 最终覆写 webpack 配置 **/
/** 客户端配置 */
overridesClientWebpack?: (conf: webpack.Configuration, env: "development" | "production", options: Options) => webpack.Configuration,
/** 服务端配置 */
overridesServerWebpack?: (conf: webpack.Configuration, env: "development" | "production", options: Options) => webpack.Configuration;
/** 公共覆盖配置 */
overridesCommonWebpack?: (conf: webpack.Configuration, env: "development" | "production", options: Options) => webpack.Configuration;
// 最终的配置
overridesWebpack?: WebpackConfigFunction
/** 服务端打包入口 */
server_path?: string,
/** 客户端打包入口 */
client_path?: string,
/** 输出文件地址 */
output_path?: string;
/** watch 配置 */
watchOptions?: webpack.Configuration["watchOptions"];
/** 代理 */
proxySetup?: (app: Application) => {
path: string | string[],
options?: MockerOption
}
}
export interface OptionsProps {
/** client 使用 NodeExternals **/
clientNodeExternals: boolean;
/** server 使用 NodeExternals **/
serverNodeExternals: boolean;
/** server 进行代码拆分 **/
serverIsChunk: boolean;
/** client 进行代码拆分 **/
clientIsChunk: boolean;
/** 是否使用原始 react-script 下的配置 **/
original: boolean,
/** 是否压缩代码 mini < miniServer/miniClient **/
mini: boolean
/** server 是否压缩代码 **/
miniServer: boolean
/** client 是否压缩代码 **/
miniClient: boolean
}