File tree Expand file tree Collapse file tree 4 files changed +29
-2
lines changed
packages/@vue/cli-service Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,17 @@ module.exports = {
2727}
2828```
2929
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+
3041### baseUrl
3142
3243Deprecated 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 = {
2626 // 选项...
2727}
2828```
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+
2941### baseUrl
3042
3143从 Vue CLI 3.3 起已弃用,请使用[ ` publicPath ` ] ( #publicpath ) 。
Original file line number Diff line number Diff line change @@ -436,3 +436,6 @@ function cloneRuleNames (to, from) {
436436 }
437437 } )
438438}
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')
33import webpack = require( 'webpack' )
44import WebpackDevServer = require( 'webpack-dev-server' )
55import express = require( 'express' ) // @types /webpack-dev-server depends on @types/express
6- import { ProjectOptions } from './ProjectOptions'
6+ import { ProjectOptions , ConfigFunction } from './ProjectOptions'
77
88type RegisterCommandFn = ( args : minimist . ParsedArgs , rawArgv : string [ ] ) => any
99
@@ -134,4 +134,5 @@ type ServicePlugin = (
134134) => any
135135
136136export { 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