1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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-website': {
- target: proxyUrl,
- changeOrigin: true
- }
- }
- },
- build: {
- rollupOptions: {
- input: {
- index: resolve('index.html')
- }
- }
- }
- })
|