1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import { defineConfig } from 'vite'
- import uni from '@dcloudio/vite-plugin-uni'
- // https://vitejs.dev/config/
- export default defineConfig({
- build: {
- // 开发阶段启用源码映射:https://uniapp.dcloud.net.cn/tutorial/migration-to-vue3.html#需主动开启-sourcemap
- sourcemap: process.env.NODE_ENV === 'development',
- },
- plugins: [
- uni(),
- {
- // 自定义插件禁用vite:vue插件的devToolsEnabled,强制编译 vue 模板时 inline 为 true
- name: 'fix-vite-plugin-vue',
- configResolved(config) {
- const plugin = config.plugins.find((p) => p.name === 'vite:vue')
- if (plugin && plugin.api && plugin.api.options) {
- plugin.api.options.devToolsEnabled = false
- }
- },
- },
- ],
- server: {
- // host: 'c3j6u3.natappfree.cc',
- host: '0.0.0.0',
- port: 80,
- // https: false,
- //设置法反向代理跨域
- // proxy: {
- // '/api': {
- // //后台地址
- // target: '',
- // changeOrigin: true,
- // rewrite: (path) => path.replace(/^\/api1/, ''),
- // },
- // },
- proxy: {
- '/api': {
- // target: 'http://i9p32r.natappfree.cc',
- target: 'http://n823va.natappfree.cc',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, ''),
- },
- },
- // proxy: {
- // '/api': {
- // target: 'http://localhost:90',
- // changeOrigin: true,
- // pathRewrite: {
- // '^/api': '',
- // },
- // },
- // },
- },
- })
|