k5web/config/vite.config.base.ts

78 lines
1.9 KiB
TypeScript
Raw Normal View History

2024-01-24 13:40:15 +00: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';
import configArcoStyleImportPlugin from './plugin/arcoStyleImport';
2024-02-04 07:13:25 +00:00
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { TDesignResolver } from 'unplugin-vue-components/resolvers';
2024-02-04 09:11:30 +00:00
import { ArcoResolver } from 'unplugin-vue-components/resolvers';
2024-02-04 07:13:25 +00:00
2024-07-02 02:55:12 +00:00
import htmlPlugin from "vite-plugin-html-config";
2024-01-24 13:40:15 +00:00
export default defineConfig({
2024-02-04 20:04:55 +00:00
base: './',
2024-01-24 13:40:15 +00:00
plugins: [
vue(),
vueJsx(),
svgLoader({ svgoConfig: {} }),
configArcoStyleImportPlugin(),
2024-02-04 07:13:25 +00:00
AutoImport({
resolvers: [TDesignResolver({
library: 'vue-next'
})],
}),
Components({
resolvers: [TDesignResolver({
library: 'vue-next'
2024-02-04 09:11:30 +00:00
}), ArcoResolver()],
2024-02-04 07:13:25 +00:00
}),
2024-07-02 02:55:12 +00:00
htmlPlugin({
metas: [
{
name: "builtTime",
content: Math.ceil(parseInt(new Date().toISOString().replace(/[.:TZ-]/g, '')) / 1000).toString()
},
]
})
2024-01-24 13:40:15 +00:00
],
resolve: {
alias: [
{
find: '@',
replacement: resolve(__dirname, '../src'),
},
{
find: 'assets',
replacement: resolve(__dirname, '../src/assets'),
},
{
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js', // Resolve the i18n warning issue
},
{
find: 'vue',
replacement: 'vue/dist/vue.esm-bundler.js', // compile template
},
],
2024-02-04 07:13:25 +00:00
extensions: ['.ts', '.js', '.css'],
2024-01-24 13:40:15 +00:00
},
define: {
'process.env': {},
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
hack: `true; @import (reference) "${resolve(
'src/assets/style/breakpoint.less'
)}";`,
},
javascriptEnabled: true,
},
},
},
});