1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import vueDevTools from 'vite-plugin-vue-devtools'
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { VantResolver } from '@vant/auto-import-resolver'
- import legacy from '@vitejs/plugin-legacy'
- // https://vite.dev/config/
- export default defineConfig({
- base: './',
- esbuild: {
- pure: ['console.log']
- },
- plugins: [
- vue(),
- legacy({
- targets: ['defaults', 'not IE 11']
- }),
- vueDevTools(),
- AutoImport({
- resolvers: [VantResolver()],
- imports: ['vue', 'vue-router'],
- defaultExportByFilename: false, // 设置为 false 不会再次生成配置文件
- dts: './auto-imports.d.ts', // 生成的自动导入配置文件信息 生成之后设置为 false 防止重复生成
- // dts: false, // 生成的自动导入配置文件信息
- // eslint报错解决
- eslintrc: {
- enabled: false, // Default `false` 生成一次后设置为false
- filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
- globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
- }
- }),
- Components({
- resolvers: [VantResolver()]
- })
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- server: {
- host: '0.0.0.0',
- cors: true,
- port: 8080
- // proxy: {
- // '/api': {
- // // target: 'http://smartelectric.worldflying.cn',
- // target: 'http://plceditor.worldflying.cn',
- // changeOrigin: true,
- // rewrite: (path) => path.replace(/^\/api/, '/api'),
- // }
- // }
- }
- })
|