1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import { resolve } from 'path';
- import { defineConfig } from 'vite';
- import vue from '@vitejs/plugin-vue';
- // import styleImport, { VantResolve } from 'vite-plugin-style-import';
- 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(),
- // styleImport({
- // // vant
- // libs: [
- // {
- // libraryName: 'vant',
- // esModule: true,
- // // https://github.com/anncwb/vite-plugin-style-import/issues/52
- // resolveStyle: (name) => `../es/${name}/style/index`,
- // // resolveStyle: (name) => `../node_modules/vant/es/${name}/style/index`, // 如果报找不到vant可以改用上面的路径
- // },
- // ],
- // // nutui
- // // libs: [
- // // {
- // // libraryName: '@nutui/nutui',
- // // libraryNameChangeCase: 'pascalCase',
- // // resolveStyle: (name) => {
- // // return `@nutui/nutui/dist/packages/${name}/index.scss`
- // // }
- // // }
- // // ]
-
- // }),
- ],
- 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: 'htttps: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/, '')
- // }
- }
- }
- })
|