| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- import vue from '@vitejs/plugin-vue';
- import Components from 'unplugin-vue-components/vite';
- import path from 'path';
- import {
- VantResolver
- } from 'unplugin-vue-components/resolvers';
- import commonjs from 'vite-plugin-commonjs'
- import {
- defineConfig
- } from 'vite'
- import uni from '@dcloudio/vite-plugin-uni'
- // https://vitejs.dev/config/
- export default defineConfig({
- plugins: [
- uni(),
- commonjs(),
- // Components({
- // resolvers: [VantResolver()],
- // }),
- ],
- css: {
- preprocessorOptions: {
- scss: {
- api: 'modern-compiler' // 使用新的现代编译器API,避免旧版JS API弃用警告
- }
- }
- },
- resolve: {
- alias: {
- '@vue/shared': '@vue/shared/dist/shared.esm-bundler.js',
- '@': 'src',
- 'jweixin-module': path.resolve(__dirname, 'src/js_sdk/jweixin-module/index.js')
- }
- },
- optimizeDeps: {
- entries: [
- 'src/main.js',
- 'src/App.vue',
- 'src/pages/**/*.vue'
- ],
- include: [
- 'tim-wx-sdk',
- 'tim-js-sdk',
- 'trtc-js-sdk',
- 'cos-wx-sdk-v5',
- 'jweixin-module'
- ]
- },
- build: {
- chunkSizeWarningLimit: 1000,
- rollupOptions: {
- output: {
- manualChunks(id) {
- if (!id.includes('node_modules')) return;
- if (/[\\/]node_modules[\\/](tim-|trtc-|cos-|webrtc-adapter)/.test(id)) {
- return 'vendor-tencent';
- }
- if (/[\\/]node_modules[\\/](@vant|weui-miniprogram|vant-aliapp)/.test(id)) {
- return 'vendor-ui';
- }
- if (/[\\/]node_modules[\\/](@dcloudio|vue|vuex|vue-router)/.test(id)) {
- return 'vendor-core';
- }
- }
- }
- }
- },
- server: {
- host: '0.0.0.0',
- warmup: {
- clientFiles: [
- 'src/main.js',
- 'src/App.vue',
- 'src/**/*.vue'
- ]
- },
- allowedHosts: [
- 'frp.12123wzcx.com' // 允许所有 frp.12123wzcx.com 的子域名
- ],
- proxy: {
- '/bdhealth': {
- target: 'https://hlwyy.scsmysgkyy.cn',
- changeOrigin: true,
- rewrite: (path) => path.replace('/bdhealth', '/bdhealth')
- },
- '/openID': {
- target: 'https://hlwyy.scsmysgkyy.cn',
- changeOrigin: true,
- rewrite: (path) => path.replace('/openID', '/openID')
- },
- '/images': {
- target: 'https://hlwyy.scsmysgkyy.cn',
- changeOrigin: true,
- rewrite: (path) => path.replace('/images', '/images')
- },
- // '/MP_verify_mRdA5h8p5Phywrus.txt': {
- // target: 'http://localhost:81',
- // changeOrigin: true,
- // rewrite: (path) => path.replace('/MP_verify_mRdA5h8p5Phywrus.txt', '/MP_verify_mRdA5h8p5Phywrus.txt')
- // },
- '/ws/': {
- target: 'https://apis.map.qq.com',
- changeOrigin: true,
- rewrite: (path) => path.replace('/ws/', '/ws/')
- },
- '/fileUp/': {
- target: 'https://np.h03.p0551.com',
- changeOrigin: true,
- rewrite: (path) => path.replace('/fileUp/', '')
- },
- '/pingd': {
- target: 'https://pingtas.qq.com',
- changeOrigin: true,
- },
- }
- },
- })
|