2023-05-24 11:08:08 +08:00
|
|
|
import { resolve } from 'path';
|
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
import vue from '@vitejs/plugin-vue';
|
|
|
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
|
|
|
import svgLoader from 'vite-svg-loader';
|
2023-08-07 18:07:57 +08:00
|
|
|
// import configArcoStyleImportPlugin from './plugin/arcoStyleImport';
|
|
|
|
// import configArcoResolverPlugin from './plugin/arcoResolver';
|
2023-05-24 11:08:08 +08:00
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
2023-06-02 17:03:13 +08:00
|
|
|
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
|
2023-05-24 11:08:08 +08:00
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
vueJsx(),
|
2023-06-02 17:03:13 +08:00
|
|
|
vueSetupExtend(),
|
2023-05-24 11:08:08 +08:00
|
|
|
svgLoader({ svgoConfig: {} }),
|
2023-08-07 18:07:57 +08:00
|
|
|
// configArcoResolverPlugin(),
|
|
|
|
// configArcoStyleImportPlugin(),
|
2023-05-24 11:08:08 +08:00
|
|
|
createSvgIconsPlugin({
|
|
|
|
// 指定需要缓存的图标文件夹
|
2023-08-07 13:47:04 +08:00
|
|
|
iconDirs: [resolve(process.cwd(), 'src/assets/svg'), resolve(process.cwd(), 'public/images')], // 与本地储存地址一致
|
2023-05-24 11:08:08 +08:00
|
|
|
// 指定symbolId格式
|
|
|
|
symbolId: 'icon-[name]',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: [
|
|
|
|
{
|
|
|
|
find: '@',
|
|
|
|
replacement: resolve(__dirname, '../src'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: 'assets',
|
|
|
|
replacement: resolve(__dirname, '../src/assets'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: 'vue-i18n',
|
2023-09-11 19:26:10 +08:00
|
|
|
replacement: 'vue-i18n/dist/vue-i18n.esm-bundler.js', // 解决 vue-i18n 依赖包报错
|
2023-05-24 11:08:08 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
find: 'vue',
|
|
|
|
replacement: 'vue/dist/vue.esm-bundler.js', // compile template
|
|
|
|
},
|
|
|
|
],
|
|
|
|
extensions: ['.ts', '.js'],
|
|
|
|
},
|
|
|
|
define: {
|
|
|
|
'process.env': {},
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
preprocessorOptions: {
|
|
|
|
less: {
|
|
|
|
modifyVars: {
|
2023-06-12 18:29:21 +08:00
|
|
|
hack: `true; @import (reference) "${resolve('src/assets/style/var.less')}";`,
|
2023-05-24 11:08:08 +08:00
|
|
|
},
|
|
|
|
javascriptEnabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|