123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import Components from 'unplugin-vue-components/vite'
- import { VantResolver } from 'unplugin-vue-components/resolvers'
- import postCssPxToRem from 'postcss-pxtorem'
- import Pages from 'vite-plugin-pages'
- import path from 'path'
- // https://vitejs.dev/config/
- export default defineConfig({
- plugins: [
- vue(),
- Pages({
- dirs: [
- { dir: 'src/page', baseRoute: '' },
- { dir: 'src/views', baseRoute: '' }
- ],
- exclude: ['**/component/*.vue'] // 排除组件
- }),
- Components({
- dts: true,
- resolvers: [VantResolver()]
- })
- ],
- resolve: {
- alias: {
- '@': path.resolve(path.resolve(), 'src')
- }
- },
- minify: 'terser',
- css: {
- postcss: {
- plugins: [
- postCssPxToRem({
- rootValue({ file }) {
- return file.indexOf('vant') !== -1 ? 37.5 : 75
- },
- propList: ['*'],
- unitPrecision: 5
- })
- ]
- }
- },
- server: {
- open: true,
- proxy: {
- '/api': {
- // 正式环境地址
- // target: 'https://dev.wutongresearch.club/api',
- // target: 'https://prod.wutongshucloud.com/api',
- target: 'http://192.168.31.181:8110',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/api/, '')
- }
- }
- }
- })
|