/
ProjectOptions.d.ts
192 lines (178 loc) · 5.79 KB
/
ProjectOptions.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import ChainableWebpackConfig = require('webpack-chain')
import { Configuration as WebpackOptions } from 'webpack'
type PredefinedOptions<T> = T & { [key: string]: any }
type PageEntry = string | string[];
interface PageConfig {
entry: PageEntry;
[key: string]: any;
}
interface LoaderOptions {
css?: object;
sass?: object;
scss?: object;
less?: object;
stylus?: object;
postcss?: object;
}
// mini-css-extract-plugin options
interface ExtractOptions {
filename?: string;
chunkFilename?: string;
}
interface CSSOptions {
/**
* Default: `true`
*
* By default, only files that ends in `*.module.[ext]` are treated as CSS modules
*/
requireModuleExtension?: boolean;
/**
* Default: `true`
*
* Whether to extract CSS in your components into a standalone CSS files (instead of inlined in JavaScript and injected dynamically)
*/
extract?: boolean | ExtractOptions;
/**
* Default: `false`
*
* Whether to enable source maps for CSS. Setting this to `true` may affect build performance
*/
sourceMap?: boolean;
/**
* Default: `{}`
*
* Pass options to CSS-related loaders
*/
loaderOptions?: LoaderOptions;
}
interface ProjectOptions {
/**
* Default: `'/'`
*
* The base URL your application bundle will be deployed at
*/
publicPath?: string;
/**
* Default: `'dist'`
*
* The directory where the production build files will be generated in when running `vue-cli-service build`
*/
outputDir?: string;
/**
* Default: `''`
*
* A directory (relative to `outputDir`) to nest generated static assets (js, css, img, fonts) under
*/
assetsDir?: string;
/**
* Default: `'index.html'`
*
* Specify the output path for the generated `index.html` (relative to `outputDir`). Can also be an absolute path
*/
indexPath?: string;
/**
* Default: `true`
*
* By default, generated static assets contains hashes in their filenames for better caching control
*/
filenameHashing?: boolean;
/**
* Default: `false`
*
* Whether to use the build of Vue core that includes the runtime compiler
*/
runtimeCompiler?: boolean;
/**
* Default: `false`
*
* If set to `true`, all dependencies in `node_modules` will be transpiled by Babel;
* Or, if you only want to selectively transpile some of the dependencies, you can list them
* in this option.
*/
transpileDependencies?: boolean | Array<string | RegExp>;
/**
* Default: `true`
*
* Setting this to `false` can speed up production builds if you don't need source maps for production
*/
productionSourceMap?: boolean;
/**
* Default: `require('os').cpus().length > 1`
*
* Whether to use `thread-loader` for Babel or TypeScript transpilation
*/
parallel?: boolean | number;
/**
* [All options for `webpack-dev-server`](https://webpack.js.org/configuration/dev-server/) are supported
*/
devServer?: { proxy: string | object, [key: string]: any };
/**
* Default: `undefined`
*
* Build the app in multi-page mode
*/
pages?: {
[key: string]: PageEntry | PageConfig;
};
/**
* Default: `undefined`
*
* Configure the `crossorigin` attribute on `<link rel="stylesheet">` and `<script>` tags in generated HTML
*/
crossorigin?: '' | 'anonymous' | 'use-credentials';
/**
* Default: `false`
*
* Set to `true` to enable [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) (SRI) on `<link rel="stylesheet">` and `<script>` tags in generated HTML
*/
integrity?: boolean;
css?: CSSOptions;
/**
* A function that will receive an instance of `ChainableConfig` powered by [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain)
*/
chainWebpack?: (config: ChainableWebpackConfig) => void;
/**
* Set webpack configuration. If the value is `Object`, will be merged into config. If value is `Function`, will receive current config as argument
*/
configureWebpack?: WebpackOptions | ((config: WebpackOptions) => (WebpackOptions | void));
/**
* Default: `'default'`
*
* Whether to perform lint-on-save during development using [eslint-loader](https://github.com/webpack-contrib/eslint-loader)
*/
lintOnSave?: boolean | 'default' | 'warning' | 'error';
/**
* Pass options to the [PWA Plugin](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa)
*/
pwa?: object;
/**
* set terser-webpack-plugin minify and terserOptions
*/
terser?: {
/**
* Supported minify: [terser](https://github.com/webpack-contrib/terser-webpack-plugin#minify), [esbuild](https://github.com/webpack-contrib/terser-webpack-plugin#esbuild), [swc](https://github.com/webpack-contrib/terser-webpack-plugin#swc), [uglifyJs](https://github.com/webpack-contrib/terser-webpack-plugin#uglify-js). currently we do not allow custom minify function
*
* In the non-terser case, you should install the corresponding package (eg. `npm i esbuild -D`)
*
*/
minify: 'terser' | 'esbuild' | 'swc' | 'uglifyJs';
/**
* `terserOptions` options will be passed to minify
*
* [All options for `terser`](https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions)
*
* [All options for `esbuild`](https://github.com/evanw/esbuild/blob/master/lib/shared/types.ts#L160-L174)
*
* [All options for `swc`](https://swc.rs/docs/config-js-minify)
*
* [All options for `uglifyJs`](https://github.com/mishoo/UglifyJS#minify-options)
*/
terserOptions?: PredefinedOptions<import("terser").MinifyOptions>;
};
/**
* This is an object that doesn't go through any schema validation, so it can be used to pass arbitrary options to 3rd party plugins
*/
pluginOptions?: object;
}
type ConfigFunction = () => ProjectOptions
export { ProjectOptions, ConfigFunction }