1 | import ChainableWebpackConfig = require('webpack-chain')
|
2 | import { Configuration as WebpackOptions } from 'webpack'
|
3 |
|
4 | type PredefinedOptions<T> = T & { [key: string]: any }
|
5 |
|
6 | type PageEntry = string | string[];
|
7 |
|
8 | interface PageConfig {
|
9 | entry: PageEntry;
|
10 | [key: string]: any;
|
11 | }
|
12 |
|
13 | interface LoaderOptions {
|
14 | css?: object;
|
15 | sass?: object;
|
16 | scss?: object;
|
17 | less?: object;
|
18 | stylus?: object;
|
19 | postcss?: object;
|
20 | }
|
21 |
|
22 | // mini-css-extract-plugin options
|
23 | interface ExtractOptions {
|
24 | filename?: string;
|
25 | chunkFilename?: string;
|
26 | }
|
27 |
|
28 | interface CSSOptions {
|
29 | /**
|
30 | * Default: `true`
|
31 | *
|
32 | * By default, only files that ends in `*.module.[ext]` are treated as CSS modules
|
33 | */
|
34 | requireModuleExtension?: boolean;
|
35 | /**
|
36 | * Default: `true`
|
37 | *
|
38 | * Whether to extract CSS in your components into a standalone CSS files (instead of inlined in JavaScript and injected dynamically)
|
39 | */
|
40 | extract?: boolean | ExtractOptions;
|
41 | /**
|
42 | * Default: `false`
|
43 | *
|
44 | * Whether to enable source maps for CSS. Setting this to `true` may affect build performance
|
45 | */
|
46 | sourceMap?: boolean;
|
47 | /**
|
48 | * Default: `{}`
|
49 | *
|
50 | * Pass options to CSS-related loaders
|
51 | */
|
52 | loaderOptions?: LoaderOptions;
|
53 | }
|
54 |
|
55 | interface ProjectOptions {
|
56 | /**
|
57 | * Default: `'/'`
|
58 | *
|
59 | * The base URL your application bundle will be deployed at
|
60 | */
|
61 | publicPath?: string;
|
62 | /**
|
63 | * Default: `'dist'`
|
64 | *
|
65 | * The directory where the production build files will be generated in when running `vue-cli-service build`
|
66 | */
|
67 | outputDir?: string;
|
68 | /**
|
69 | * Default: `''`
|
70 | *
|
71 | * A directory (relative to `outputDir`) to nest generated static assets (js, css, img, fonts) under
|
72 | */
|
73 | assetsDir?: string;
|
74 | /**
|
75 | * Default: `'index.html'`
|
76 | *
|
77 | * Specify the output path for the generated `index.html` (relative to `outputDir`). Can also be an absolute path
|
78 | */
|
79 | indexPath?: string;
|
80 | /**
|
81 | * Default: `true`
|
82 | *
|
83 | * By default, generated static assets contains hashes in their filenames for better caching control
|
84 | */
|
85 | filenameHashing?: boolean;
|
86 | /**
|
87 | * Default: `false`
|
88 | *
|
89 | * Whether to use the build of Vue core that includes the runtime compiler
|
90 | */
|
91 | runtimeCompiler?: boolean;
|
92 | /**
|
93 | * Default: `false`
|
94 | *
|
95 | * If set to `true`, all dependencies in `node_modules` will be transpiled by Babel;
|
96 | * Or, if you only want to selectively transpile some of the dependencies, you can list them
|
97 | * in this option.
|
98 | */
|
99 | transpileDependencies?: boolean | Array<string | RegExp>;
|
100 | /**
|
101 | * Default: `true`
|
102 | *
|
103 | * Setting this to `false` can speed up production builds if you don't need source maps for production
|
104 | */
|
105 | productionSourceMap?: boolean;
|
106 | /**
|
107 | * Default: `require('os').cpus().length > 1`
|
108 | *
|
109 | * Whether to use `thread-loader` for Babel or TypeScript transpilation
|
110 | */
|
111 | parallel?: boolean | number;
|
112 | /**
|
113 | * [All options for `webpack-dev-server`](https://webpack.js.org/configuration/dev-server/) are supported
|
114 | */
|
115 | devServer?: { proxy?: string | object, [key: string]: any };
|
116 | /**
|
117 | * Default: `undefined`
|
118 | *
|
119 | * Build the app in multi-page mode
|
120 | */
|
121 | pages?: {
|
122 | [key: string]: PageEntry | PageConfig;
|
123 | };
|
124 | /**
|
125 | * Default: `undefined`
|
126 | *
|
127 | * Configure the `crossorigin` attribute on `<link rel="stylesheet">` and `<script>` tags in generated HTML
|
128 | */
|
129 | crossorigin?: '' | 'anonymous' | 'use-credentials';
|
130 | /**
|
131 | * Default: `false`
|
132 | *
|
133 | * 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
|
134 | */
|
135 | integrity?: boolean;
|
136 |
|
137 | css?: CSSOptions;
|
138 |
|
139 | /**
|
140 | * A function that will receive an instance of `ChainableConfig` powered by [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain)
|
141 | */
|
142 | chainWebpack?: (config: ChainableWebpackConfig) => void;
|
143 | /**
|
144 | * Set webpack configuration. If the value is `Object`, will be merged into config. If value is `Function`, will receive current config as argument
|
145 | */
|
146 | configureWebpack?: WebpackOptions | ((config: WebpackOptions) => (WebpackOptions | void));
|
147 |
|
148 | /**
|
149 | * Default: `'default'`
|
150 | *
|
151 | * Whether to perform lint-on-save during development using [eslint-loader](https://github.com/webpack-contrib/eslint-loader)
|
152 | */
|
153 | lintOnSave?: boolean | 'default' | 'warning' | 'error';
|
154 | /**
|
155 | * Pass options to the [PWA Plugin](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa)
|
156 | */
|
157 | pwa?: object;
|
158 |
|
159 | /**
|
160 | * set terser-webpack-plugin minify and terserOptions
|
161 | */
|
162 | terser?: {
|
163 | /**
|
164 | * 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
|
165 | *
|
166 | * In the non-terser case, you should install the corresponding package (eg. `npm i esbuild -D`)
|
167 | *
|
168 | */
|
169 | minify: 'terser' | 'esbuild' | 'swc' | 'uglifyJs';
|
170 | /**
|
171 | * `terserOptions` options will be passed to minify
|
172 | *
|
173 | * [All options for `terser`](https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions)
|
174 | *
|
175 | * [All options for `esbuild`](https://github.com/evanw/esbuild/blob/master/lib/shared/types.ts#L160-L174)
|
176 | *
|
177 | * [All options for `swc`](https://swc.rs/docs/config-js-minify)
|
178 | *
|
179 | * [All options for `uglifyJs`](https://github.com/mishoo/UglifyJS#minify-options)
|
180 | */
|
181 | terserOptions?: PredefinedOptions<import("terser").MinifyOptions>;
|
182 | };
|
183 |
|
184 | /**
|
185 | * 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
|
186 | */
|
187 | pluginOptions?: object;
|
188 | }
|
189 |
|
190 | type ConfigFunction = () => ProjectOptions
|
191 |
|
192 | export { ProjectOptions, ConfigFunction }
|
193 |
|
\ | No newline at end of file |