2023-05-24 11:08:08 +08:00
|
|
|
import vue from '@vitejs/plugin-vue';
|
|
|
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
2023-10-17 10:35:21 +08:00
|
|
|
import { resolve } from 'path';
|
|
|
|
import AutoImport from 'unplugin-auto-import/vite';
|
|
|
|
import { defineConfig } from 'vite';
|
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-10-17 10:35:21 +08:00
|
|
|
import svgLoader from 'vite-svg-loader';
|
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]',
|
|
|
|
}),
|
2023-10-10 20:06:38 +08:00
|
|
|
AutoImport({
|
|
|
|
include: [
|
|
|
|
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
|
|
|
|
/\.vue$/,
|
|
|
|
/\.vue\?vue/, // .vue
|
|
|
|
/\.md$/, // .md
|
|
|
|
],
|
|
|
|
imports: ['vue'],
|
|
|
|
dts: 'src/auto-import.d.ts',
|
|
|
|
eslintrc: {
|
|
|
|
enabled: true, // <-- this
|
|
|
|
},
|
|
|
|
}),
|
2023-05-24 11:08:08 +08:00
|
|
|
],
|
|
|
|
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
|
|
|
|
},
|
2023-12-28 15:48:44 +08:00
|
|
|
{
|
|
|
|
find: '@tiptap/pm/state',
|
|
|
|
replacement: '@halo-dev/richtext-editor',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: '@tiptap/pm/model',
|
|
|
|
replacement: '@halo-dev/richtext-editor',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: '@tiptap/core',
|
|
|
|
replacement: '@halo-dev/richtext-editor',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: '@tiptap/pm/view',
|
|
|
|
replacement: '@halo-dev/richtext-editor',
|
|
|
|
},
|
2023-05-24 11:08:08 +08:00
|
|
|
],
|
|
|
|
extensions: ['.ts', '.js'],
|
|
|
|
},
|
|
|
|
define: {
|
|
|
|
'process.env': {},
|
2024-01-24 16:17:50 +08:00
|
|
|
// 定义特性标志
|
|
|
|
'__VUE_OPTIONS_API__': true,
|
|
|
|
'__VUE_PROD_DEVTOOLS__': false,
|
|
|
|
// 设置hydration不匹配详细信息的标志
|
|
|
|
'__VUE_PROD_HYDRATION_MISMATCH_DETAILS__': true,
|
2023-05-24 11:08:08 +08:00
|
|
|
},
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|