123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- // import styleImport from 'vite-plugin-style-import'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- import legacy from '@vitejs/plugin-legacy'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- // eslint-disable-next-line @typescript-eslint/no-var-requires
- const path = require('path')
- function resolve(dir: string) {
- return path.join(__dirname, dir)
- }
- // https://vitejs.dev/config/
- // https://github.com/vitejs/vite/issues/1930 .env
- // const proxyUrl = 'https://www.colexiu.com/';
- const proxyUrl = 'https://test.colexiu.com/'
- export default defineConfig({
- base: './',
- plugins: [
- vue(),
- vueJsx(),
- legacy({
- targets: ['> 0.25%, not dead'],
- ignoreBrowserslistConfig: true
- }),
- AutoImport({
- resolvers: [ElementPlusResolver()]
- }),
- Components({
- resolvers: [ElementPlusResolver()]
- })
- ],
- css: {
- preprocessorOptions: {
- scss: {
- charset: false
- }
- },
- postcss: {
- plugins: [
- {
- postcssPlugin: 'internal:charset-removal',
- AtRule: {
- charset: atRule => {
- if (atRule.name === 'charset') {
- atRule.remove()
- }
- }
- }
- },
- require('tailwindcss'),
- require('autoprefixer')
- ]
- }
- },
- resolve: {
- alias: {
- '@': resolve('./src'),
- '@common': resolve('./src/common'),
- '@components': resolve('./src/components'),
- '@store': resolve('./src/store'),
- '@views': resolve('./src/views')
- }
- },
- server: {
- host: '0.0.0.0',
- port: 5100,
- strictPort: true,
- proxy: {
- '/api-auth': {
- target: proxyUrl,
- changeOrigin: true
- },
- '/api-teacher': {
- target: proxyUrl,
- changeOrigin: true
- },
- '/api-website': {
- target: proxyUrl,
- changeOrigin: true
- }
- }
- },
- build: {
- rollupOptions: {
- input: {
- index: resolve('index.html')
- }
- }
- }
- })
|