12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import { defineConfig } from 'vite';
- import vue from '@vitejs/plugin-vue';
- import vueJsx from '@vitejs/plugin-vue-jsx';
- import Components from 'unplugin-vue-components/vite';
- import { VantResolver } from 'unplugin-vue-components/resolvers';
- import viteESLint from 'vite-plugin-eslint';
- import legacy from '@vitejs/plugin-legacy'
- // 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://test.dayaedu.com/';
- export default defineConfig({
- base: './',
- plugins: [
- legacy({
- targets: 'last 2 versions and not dead, > 0.3%, Firefox ESR'
- }),
- vue(),
- vueJsx(),
- viteESLint(),
- Components({
- resolvers: [VantResolver()]
- })
- ],
- 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: 9002,
- strictPort: true,
- cors: true,
- https: false,
- proxy: {
- '/api-auth': {
- target: proxyUrl,
- changeOrigin: true
- },
- '/api-web': {
- target: proxyUrl,
- changeOrigin: true
- },
- '/api-teacher': {
- target: proxyUrl,
- changeOrigin: true
- },
- '/api-student': {
- target: proxyUrl,
- changeOrigin: true
- }
- }
- }
- });
|