File tree 4 files changed +29
-2
lines changed
packages/@vue/cli-service
4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,17 @@ module.exports = {
27
27
}
28
28
```
29
29
30
+ Or, you can use the ` defineConfig ` helper from ` @vue/cli-service ` , which could provide better intellisense support:
31
+
32
+ ``` js
33
+ // vue.config.js
34
+ const { defineConfig } = require (' @vue/cli-service' )
35
+
36
+ module .exports = defineConfig ({
37
+ // options...
38
+ })
39
+ ```
40
+
30
41
### baseUrl
31
42
32
43
Deprecated since Vue CLI 3.3, please use [ ` publicPath ` ] ( #publicPath ) instead.
Original file line number Diff line number Diff line change @@ -26,6 +26,18 @@ module.exports = {
26
26
// 选项...
27
27
}
28
28
```
29
+
30
+ 或者,你也可以使用 ` @vue/cli-service ` 提供的 ` defineConfig ` 帮手函数,以获得更好的类型提示:
31
+
32
+ ``` js
33
+ // vue.config.js
34
+ const { defineConfig } = require (' @vue/cli-service' )
35
+
36
+ module .exports = defineConfig ({
37
+ // 选项
38
+ })
39
+ ```
40
+
29
41
### baseUrl
30
42
31
43
从 Vue CLI 3.3 起已弃用,请使用[ ` publicPath ` ] ( #publicpath ) 。
Original file line number Diff line number Diff line change @@ -436,3 +436,6 @@ function cloneRuleNames (to, from) {
436
436
}
437
437
} )
438
438
}
439
+
440
+ /** @type {import('../types/index').defineConfig } */
441
+ module . exports . defineConfig = ( config ) => config
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import ChainableConfig = require('webpack-chain')
3
3
import webpack = require( 'webpack' )
4
4
import WebpackDevServer = require( 'webpack-dev-server' )
5
5
import express = require( 'express' ) // @types /webpack-dev-server depends on @types/express
6
- import { ProjectOptions } from './ProjectOptions'
6
+ import { ProjectOptions , ConfigFunction } from './ProjectOptions'
7
7
8
8
type RegisterCommandFn = ( args : minimist . ParsedArgs , rawArgv : string [ ] ) => any
9
9
@@ -134,4 +134,5 @@ type ServicePlugin = (
134
134
) => any
135
135
136
136
export { ProjectOptions , ServicePlugin , PluginAPI }
137
- export { ConfigFunction } from './ProjectOptions'
137
+ type UserConfig = ProjectOptions | ConfigFunction
138
+ export function defineConfig ( config : UserConfig ) : UserConfig
You can’t perform that action at this time.
0 commit comments