1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import { defineConfig, UserConfigExport } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import path from 'path'
- import WindiCss from 'vite-plugin-windicss';
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- import Icons from 'unplugin-icons/vite'
- import IconsResolver from 'unplugin-icons/resolver'
- // https://vitejs.dev/config/
- export default defineConfig(({ command }) => {
- const config: UserConfigExport = {
- base: '/manage/',
- // base: '/app/xdjy/',
- // base: '/app/xdhq/',
- resolve: {
- alias: {
- '~': `${path.resolve(__dirname, 'src')}`,
- '~/': `${path.resolve(__dirname, 'src/')}`,
- '~components': `${path.resolve(__dirname, 'src/components')}`,
- '@': `${path.resolve(__dirname, 'src')}`,
- },
- },
- css: {
- preprocessorOptions: {
- scss: {
- additionalData: `@use "~/styles/element/index.scss" as *;`,
- },
- },
- },
- plugins: [
- vue({
- reactivityTransform: true
- }),
- WindiCss(),
- AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver(), IconsResolver()],
- }),
- Icons({
- compiler: 'vue3',
- autoInstall: true,
- }),
- ],
- build: {
- // target: 'modules'
- target: 'esnext',
- rollupOptions: {
- output: {
- manualChunks: {
- lodash: ['lodash-es'],
- echarts: ['echarts'],
- axios: ['axios']
- }
- }
- }
- },
- }
- if (command === 'serve') {
- config.base = "/"
- } else {
- }
- return config
- }
- )
|