This repository has been archived by the owner on May 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate-webpack-config.d.ts
158 lines (131 loc) · 3.34 KB
/
create-webpack-config.d.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
* Generate Webpack entries from the given directory
*/
export function autoloadEntries(dir: string): {[key: string]: string};
export interface HtmlPluginOptions {
template: string;
}
export interface BabelOptions {
presets: any[];
plugins: any[];
[key: string]: any;
}
interface Options {
/**
* Port to listen with the dev server
*/
devServerPort?: number;
/**
* https://github.com/jantimon/html-webpack-plugin#options
*/
htmlPlugin?: HtmlPluginOptions;
/**
* Shorcut for the htmlPlugin template option
*/
template?: string;
/**
* Allow hot module replacement over and dynamic imports over CORS domains
* during development
*/
cors?: boolean;
/**
* Add hash to the generated files
*/
hashFilenames?: boolean;
/**
* Custom dev server host for CORS usage. Defaults to localhost
*/
devServerHost?: string;
/**
*
*/
outputPath?: string;
/**
* https://webpack.js.org/configuration/output/#output-publicpath
*/
publicPath?: string;
/**
* https://webpack.js.org/configuration/dev-server/#devserver-historyapifallback
*/
historyApiFallback?: boolean;
/**
* https://github.com/webpack-contrib/webpack-bundle-analyzer
*/
bundleAnalyzerPlugin?: boolean;
/**
* https://webpack.js.org/plugins/split-chunks-plugin/#split-chunks-example-1
*/
extractCommons?: boolean;
/**
* Extract css bundle
*/
extractCss?: boolean;
/**
* Add LimitChunkCountPlugin with given maxChunks value
*
* https://webpack.js.org/plugins/limit-chunk-count-plugin/
*/
maxChunks?: number;
/**
* Enable sass loader
*/
sass?: boolean;
sassOptions?: any;
/**
* Enable custom babel plugins
*/
babelPlugins?: (string | [string, any] | Function)[];
/**
* Enable custom Webpack plugins
*/
webpackPlugins?: any[];
/**
* Enable custom Webpack rules AKA loaders
*/
webpackRules?: any[];
/**
* Array of node_module to compile with Babel
*/
compileNodeModules?: string[];
/**
* Manual customization of babel config without opt-in to a babelrc file
*/
customizeBabelOptions?: (babel: {
defaultOptions: BabelOptions;
babelrcOptions: BabelOptions;
babelrc: string;
filename: string;
hasFilesystemConfig: boolean;
}) => any;
/**
* Toggle manifest creation. Defaults to true
*/
manifest?: boolean;
/**
* Toggle minimization optimization. Defaults to true.
*/
minimize?: boolean;
/**
* Manual cusomization of the generated config
*/
customize?: (config: WebpackConfig) => any;
}
interface WebpackConfig {
entry: any;
output: any;
devServer: any;
resolve: any;
module: any;
plugins: any;
[key: string]: any;
}
export function createWebpackConfig(
options: Options,
customize: (options: Options) => any
): WebpackConfig;
export default createWebpackConfig;
declare global {
const WEBPACK_GIT_DATE: string;
const WEBPACK_GIT_REV: string;
const WEBPACK_BUILD_DATE: string;
}