32 lines
869 B
JavaScript
32 lines
869 B
JavaScript
import { defineConfig } from 'vite'
|
||
import { createVuePlugin } from 'vite-plugin-vue2'
|
||
import { resolve } from 'path'
|
||
import viteSvgIcons from 'vite-plugin-svg-icons'
|
||
|
||
// vite.config.js
|
||
export default defineConfig({
|
||
esbuild: {
|
||
jsxFactory: 'h',
|
||
jsxFragment: 'Fragment'
|
||
},
|
||
plugins: [
|
||
viteSvgIcons({
|
||
// 指定需要缓存的图标文件夹
|
||
iconDirs: [resolve(process.cwd(), 'src/icons/svg')],
|
||
// 指定symbolId格式
|
||
symbolId: 'icon-[name]'
|
||
}),
|
||
createVuePlugin({
|
||
jsx: true, vueTemplateOptions: { compilerOptions: { whitespace: 'condense' }},
|
||
jsxOptions: { compositionAPI: true }
|
||
})
|
||
],
|
||
resolve: {
|
||
extensions: ['.vue', '.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
|
||
alias: {
|
||
// vue2项目别名一般都是@,vue3中一般使用/@/, 为方便使用
|
||
'@': resolve('src')
|
||
}
|
||
}
|
||
})
|