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