123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import path from 'path'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- // import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
- import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
- // https://vitejs.dev/config/
- export default defineConfig({
- base: './',
- resolve: {
- alias: {
- '~/': `${path.resolve(__dirname, 'src')}/`
- }
- },
- css: {
- preprocessorOptions: {
- scss: {
- additionalData: `@use "~/styles/element/index.scss" as *;`
- // `@import "~/styles/index.scss";`
- }
- }
- },
- server: {
- proxy: {
- '/api': {
- // target: 'https://www.yixiangvr.com/api/',
- target: 'https://vr-new.hdlkeji.com/api/',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/api/, ''),
- }
- }
- },
- build: {
- target: 'es2020'
- },
- optimizedeps: {
- esbuildoptions: {
- target: 'es2020'
- }
- },
- plugins: [
- vue(),
- createSvgIconsPlugin({
- iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
- symbolId: 'icon-[dir]-[name]',
- }),
- AutoImport({
- resolvers: [ElementPlusResolver({
- importStyle: "sass"
- })]
- }),
- Components({
- resolvers: [ElementPlusResolver({
- importStyle: "sass"
- })]
- })
- ]
- })
|