@vtj / cli / CreateViteConfigOptions
Interface: CreateViteConfigOptions
createViteConfig函数参数
Extended by
Properties
alias?
optional
alias:Record
<string
,string
>
别名
Defined in
packages/cli/src/vite/types.ts:101
babel?
optional
babel:boolean
开启babel
Defined in
packages/cli/src/vite/types.ts:191
base?
optional
base:string
开发或生产环境服务的公共基础路径
Defined in
packages/cli/src/vite/types.ts:51
buildEnd()?
optional
buildEnd: (error
?) =>void
编译完成时触发回调函数
Parameters
error?
any
Returns
void
Defined in
packages/cli/src/vite/types.ts:245
buildTarget?
optional
buildTarget:string
编译语法版本 esnext / es2015
Defined in
packages/cli/src/vite/types.ts:126
cdn?
optional
cdn:CdnPluginOptions
CDN配置
Defined in
packages/cli/src/vite/types.ts:260
copyPublicDir?
optional
copyPublicDir:boolean
默认情况下,Vite 会在构建阶段将 publicDir 目录中的所有文件复制到 outDir 目录中。可以通过设置该选项为 false 来禁用该行为。
Defined in
packages/cli/src/vite/types.ts:250
copyStatic?
optional
copyStatic:boolean
打包复制静态目录
Defined in
packages/cli/src/vite/types.ts:211
debug?
optional
debug:boolean
打印最终 vite.config
Defined in
packages/cli/src/vite/types.ts:41
defineConfig()?
optional
defineConfig: (config
) =>UserConfigExport
自定义配置 vite 配置
Parameters
config
UserConfig
Returns
UserConfigExport
Defined in
packages/cli/src/vite/types.ts:66
devtools?
optional
devtools:boolean
|VitePluginVueDevToolsOptions
开启 VueDevTools
Defined in
packages/cli/src/vite/types.ts:255
dts?
optional
dts:boolean
生成定义文件, 在库模式有效
Defined in
packages/cli/src/vite/types.ts:106
dtsOutputDir?
optional
dtsOutputDir:string
定义文件输出文件夹
Defined in
packages/cli/src/vite/types.ts:111
elementPlus?
optional
elementPlus:boolean
|Record
<string
,any
>
开启 unplugin-element-plus
Defined in
packages/cli/src/vite/types.ts:201
emptyOutDir?
optional
emptyOutDir:boolean
清空输出目录
Defined in
packages/cli/src/vite/types.ts:61
entry?
optional
entry:string
lib 入口文件
Defined in
packages/cli/src/vite/types.ts:136
envPath?
optional
envPath:string
环境配置文件目录位置
Defined in
packages/cli/src/vite/types.ts:226
exports?
optional
exports:"default"
|"auto"
|"named"
|"none"
类库导出名称模式, 默认 auto https://rollupjs.org/configuration-options/#output-exports
Defined in
packages/cli/src/vite/types.ts:238
external?
optional
external:string
[]
不打包的依赖
Defined in
packages/cli/src/vite/types.ts:141
externalGlobals?
optional
externalGlobals:Record
<string
,string
>
从全局引用的依赖
Defined in
packages/cli/src/vite/types.ts:146
force?
optional
force:boolean
强制更新依赖
Defined in
packages/cli/src/vite/types.ts:171
formats?
optional
formats:string
[]
库模式输入格式
Defined in
packages/cli/src/vite/types.ts:156
host?
optional
host:string
主机头
Defined in
packages/cli/src/vite/types.ts:81
https?
optional
https:boolean
开启https
Defined in
packages/cli/src/vite/types.ts:86
legacy?
optional
legacy:boolean
适配传统浏览器, 在非库模式下有效
Defined in
packages/cli/src/vite/types.ts:116
lib?
optional
lib:boolean
库模式
Defined in
packages/cli/src/vite/types.ts:46
libFileName?
optional
libFileName:string
库模式编译输出文件名
Defined in
packages/cli/src/vite/types.ts:161
library?
optional
library:string
库模式在umd文件导出变量名称
Defined in
packages/cli/src/vite/types.ts:151
loading?
optional
loading:boolean
生成 loading html
Defined in
packages/cli/src/vite/types.ts:221
manualChunks()?
optional
manualChunks: (id
) =>string
|void
自定义 chunk name, 在库模式无效
Parameters
id
string
Returns
string
| void
Defined in
packages/cli/src/vite/types.ts:166
node?
optional
node:boolean
|PolyfillOptions
开启 nodePolyfills https://github.com/davidmyersdev/vite-plugin-node-polyfills
Defined in
packages/cli/src/vite/types.ts:232
optimizeDeps?
optional
optimizeDeps:string
[]
预构建依赖
Defined in
packages/cli/src/vite/types.ts:176
outDir?
optional
outDir:string
打包输出文件夹
Defined in
packages/cli/src/vite/types.ts:56
pages?
optional
pages:Record
<string
,string
>
多页面模式
Defined in
packages/cli/src/vite/types.ts:216
plugins?
optional
plugins:PluginOption
[]
插件
Defined in
packages/cli/src/vite/types.ts:186
polyfills?
optional
polyfills:boolean
|string
[]
设置 polyfills,在非库模式下有效,默认为true
Defined in
packages/cli/src/vite/types.ts:131
port?
optional
port:number
开发端口
Defined in
packages/cli/src/vite/types.ts:71
previewPort?
optional
previewPort:number
预览端口
Defined in
packages/cli/src/vite/types.ts:76
proxy?
optional
proxy:ProxyConfig
代理
Defined in
packages/cli/src/vite/types.ts:91
staticDirs?
optional
staticDirs: (string
|StaticPluginOption
)[]
静态服务目录
Defined in
packages/cli/src/vite/types.ts:206
styleBundler?
optional
styleBundler:boolean
StyleBundler sassOptions
Defined in
packages/cli/src/vite/types.ts:265
targets?
optional
targets:string
|string
[]
编译目标浏览器
Defined in
packages/cli/src/vite/types.ts:121
version?
optional
version:boolean
开启生成版本号文件
Defined in
packages/cli/src/vite/types.ts:196
visualizer?
optional
visualizer:boolean
生成报告
Defined in
packages/cli/src/vite/types.ts:181
watchModules?
optional
watchModules:string
[]
Vite 服务器默认会忽略对 .git/ 和 node_modules/ 目录的监听。如果你需要对 node_modules/ 内的包进行监听
Defined in
packages/cli/src/vite/types.ts:96