初始化
This commit is contained in:
43
mokee-gateway-web/vite.widget.config.ts
Normal file
43
mokee-gateway-web/vite.widget.config.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Vite Library Mode 构建配置 — 用户头像下拉 Widget
|
||||
*
|
||||
* 产物:
|
||||
* - dist/widgets/user-chip.js IIFE 格式,包含 Vue + Element Plus 组件 + 业务代码
|
||||
* - dist/widgets/user-chip.css 提取的 CSS
|
||||
*
|
||||
* 使用:npm run build:widget
|
||||
*/
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import path from 'path'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, 'src'),
|
||||
},
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist/widgets',
|
||||
lib: {
|
||||
entry: path.resolve(__dirname, 'src/widgets/user-chip/main.ts'),
|
||||
name: 'MokeeUserChip',
|
||||
formats: ['iife'],
|
||||
fileName: () => 'user-chip.js',
|
||||
},
|
||||
rollupOptions: {
|
||||
// 全部依赖打入包内,外部系统无需前置依赖
|
||||
external: [],
|
||||
output: {
|
||||
assetFileNames: (assetInfo) => {
|
||||
if (assetInfo.name?.endsWith('.css')) return 'user-chip.css'
|
||||
return assetInfo.name || '[name]-[hash][extname]'
|
||||
},
|
||||
},
|
||||
},
|
||||
target: 'es2015',
|
||||
cssTarget: 'chrome61',
|
||||
sourcemap: false,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user