123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import { resolve } from 'path';
- import { defineConfig } from 'vite';
- import vue from '@vitejs/plugin-vue';
- // import styleImport, { VantResolve } from 'vite-plugin-style-import';
- import Components from 'unplugin-vue-components/vite';
- import {
- AntDesignVueResolver,
- ElementPlusResolver,
- VantResolver,
- } from 'unplugin-vue-components/resolvers'
- function pathResolve(dir) {
- return resolve(__dirname, dir);
- }
- // https://vitejs.dev/config/
- export default defineConfig({
- base: './',
- build: {
- outDir: 'dist/punchin'
- },
- resolve:{
- alias:[
- {
- find: '@',
- replacement: pathResolve('src'),
- }
- ],
- },
- plugins: [
- vue(),
- Components({
- resolvers: [
- AntDesignVueResolver(),
- ElementPlusResolver(),
- VantResolver(),
- ],
- }),
- ],
- css: {
- preprocessorOptions: {
- scss: {
- charset: false,
- // 配置 nutui 全局 scss 变量
- // additionalData: `@import "@nutui/nutui/dist/styles/variables.scss";`
- }
- }
- },
- server: {
- proxy: {
- // 字符串简写写法
- // '/api': 'http://www.myblog.com/api',
- // 选项写法
- '/app-api': {
- target: 'https:alipearlapp.snjon.com',
- // "https://ios.alipearlhair.com",//正式站 'http://www.myblog.com',
- changeOrigin: true, // 设置成false报错
- // rewrite: (path) => {
- // console.log(path,'ooooooooooooo');
- // path.replace(/^\/api/, '')
- // }
- },
- '/api': {
- target: "http://actapi.snjon.com",//'http://www.myblog.com',
- changeOrigin: true, // 设置成false报错
- // rewrite: (path) => {
- // console.log(path,'ooooooooooooo');
- // path.replace(/^\/api/, '')
- // }
- }
- // 正则表达式写法
- // '^/fallback/.*': {
- // target: 'http://jsonplaceholder.typicode.com',
- // changeOrigin: true,
- // rewrite: (path) => path.replace(/^\/fallback/, '')
- // }
- }
- }
- })
|