chore: refact webRTC relative logic and update npm module
This commit is contained in:
131
vite.config.js
131
vite.config.js
@@ -1,61 +1,70 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': '/src',
|
||||
}
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080', // 后端服务器地址
|
||||
changeOrigin: true, // 允许跨域
|
||||
rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径,去掉 /api 前缀
|
||||
},
|
||||
'/proxy': {
|
||||
target: 'http://localhost:3000', // 代理服务器的地址
|
||||
changeOrigin: true, // 必须设置为 true,才能避免跨域问题
|
||||
// rewrite: (path) => path.replace(/^\/proxy/, ''), // 重写路径,去掉 /api 前缀
|
||||
|
||||
},
|
||||
'/ws': {
|
||||
target: 'ws://localhost:8080',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
// '/ws': {
|
||||
// target: 'ws://localhost:8080',
|
||||
// changeOrigin: true,
|
||||
// ws: true,
|
||||
// }
|
||||
},
|
||||
host: '0.0.0.0',
|
||||
port: 5173,
|
||||
},
|
||||
// server: {
|
||||
// https:{
|
||||
// key: fs.readFileSync('./cert/merlin.xin.key'),
|
||||
// cert: fs.readFileSync('./cert/merlin.xin.pem'),
|
||||
// },
|
||||
// proxy: {
|
||||
// '/api': {
|
||||
// target: 'https://localhost:8443', // 后端服务器地址
|
||||
// changeOrigin: true, // 允许跨域
|
||||
// rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径,去掉 /api 前缀
|
||||
// },
|
||||
// '/online':{
|
||||
// target:'wss://localhost:8443/online',
|
||||
// changeOrigin:true,
|
||||
// ws:true,
|
||||
// },
|
||||
// '/voice':{
|
||||
// target:'wss://localhost:8443/voice',
|
||||
// changeOrigin:true,
|
||||
// ws:true,
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
});
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': '/src',
|
||||
}
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080', // 后端服务器地址
|
||||
changeOrigin: true, // 允许跨域
|
||||
rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径,去掉 /api 前缀
|
||||
},
|
||||
'/proxy': {
|
||||
target: 'http://localhost:3000', // 代理服务器的地址
|
||||
changeOrigin: true, // 必须设置为 true,才能避免跨域问题
|
||||
// rewrite: (path) => path.replace(/^\/proxy/, ''), // 重写路径,去掉 /api 前缀
|
||||
|
||||
},
|
||||
'/ws': {
|
||||
target: 'ws://localhost:8080',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
// '/ws': {
|
||||
// target: 'ws://localhost:8080',
|
||||
// changeOrigin: true,
|
||||
// ws: true,
|
||||
// }
|
||||
},
|
||||
host: '0.0.0.0',
|
||||
port: 5173,
|
||||
},
|
||||
// server: {
|
||||
// https:{
|
||||
// key: fs.readFileSync('./cert/merlin.xin.key'),
|
||||
// cert: fs.readFileSync('./cert/merlin.xin.pem'),
|
||||
// },
|
||||
// proxy: {
|
||||
// '/api': {
|
||||
// target: 'https://localhost:8443', // 后端服务器地址
|
||||
// changeOrigin: true, // 允许跨域
|
||||
// rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径,去掉 /api 前缀
|
||||
// },
|
||||
// '/online':{
|
||||
// target:'wss://localhost:8443/online',
|
||||
// changeOrigin:true,
|
||||
// ws:true,
|
||||
// },
|
||||
// '/voice':{
|
||||
// target:'wss://localhost:8443/voice',
|
||||
// changeOrigin:true,
|
||||
// ws:true,
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
define: {
|
||||
'process.env.STUN_URL': JSON.stringify(process.env.STUN_URL),
|
||||
'process.env.TURN_URL': JSON.stringify(process.env.TURN_URL),
|
||||
'process.env.TURN_USERNAME': JSON.stringify(process.env.TURN_USERNAME),
|
||||
'process.env.TURN_CREDENTIAL': JSON.stringify(process.env.TURN_CREDENTIAL),
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user