mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-07-09 00:00:04 +08:00
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import vue from '@vitejs/plugin-vue'
|
|
import viteSvgIcons from 'vite-plugin-svg-icons'
|
|
import path from 'path'
|
|
import pkg from './package.json'
|
|
|
|
export default {
|
|
base: './',
|
|
build: {
|
|
minify: false,
|
|
cssCodeSplit: true, // 将组件的 style 打包到 js 文件中
|
|
outDir: 'dist',
|
|
lib: {
|
|
target: 'esnext',
|
|
formats: ['iife'],
|
|
entry: path.resolve(__dirname, 'src/index.js'),
|
|
name: 'MagicComponent',
|
|
fileName: (format) => `magic-component.${pkg.version}.${format}.js`
|
|
},
|
|
rollupOptions: {
|
|
// 确保外部化处理那些你不想打包进库的依赖
|
|
external: ['vue'],
|
|
output: {
|
|
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
|
|
globals: {
|
|
vue: 'Vue'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
viteSvgIcons({
|
|
iconDirs: [path.resolve(process.cwd(), 'src/icons')],
|
|
symbolId: 'magic-component-[name]'
|
|
}),
|
|
]
|
|
}
|