71 lines
1.9 KiB
JavaScript
71 lines
1.9 KiB
JavaScript
import {defineConfig} from '@rsbuild/core';
|
|
import {pluginVue2} from '@rsbuild/plugin-vue2';
|
|
import {pluginSass} from '@rsbuild/plugin-sass';
|
|
import {pluginBabel} from '@rsbuild/plugin-babel';
|
|
import path from "path";
|
|
|
|
const proxy = process.env.VUE_APP_API || "http://192.168.1.87:9000"
|
|
const port = process.env.VUE_APP_PORT || 7000
|
|
const entry = process.env.NODE_ENV == "production" ? "./src/main.js" : "./examples/main.js"
|
|
console.log("当前模式:", process.env.NODE_ENV)
|
|
console.log("当前后台服务地址:", proxy, "\n")
|
|
export default defineConfig({
|
|
plugins: [pluginVue2(),
|
|
pluginSass({
|
|
sassLoaderOptions: {
|
|
additionalData: `@import "~dui/lib/styles/vars.scss";`
|
|
}
|
|
}),
|
|
// pluginBabel({
|
|
// include: [
|
|
// path.resolve(__dirname, 'packages'),
|
|
// path.resolve(__dirname, 'project'),
|
|
// path.resolve(__dirname, 'examples'),
|
|
// path.resolve(__dirname, 'src'),
|
|
// path.resolve(__dirname, 'ui/packages'),
|
|
// path.resolve(__dirname, 'ui/dv'),
|
|
// path.resolve(__dirname, 'ui/lib/js'),
|
|
// ]
|
|
// })
|
|
],
|
|
source: {
|
|
// 指定入口文件
|
|
entry: {
|
|
index: entry,
|
|
},
|
|
alias: {
|
|
'@packages': path.resolve(__dirname, 'packages'),
|
|
'@project': path.resolve(__dirname, 'project'),
|
|
'dui': path.resolve(__dirname, 'ui'),
|
|
}
|
|
},
|
|
html: {
|
|
template: './public/index.html',
|
|
},
|
|
server: {
|
|
host: '0.0.0.0', //主机地址
|
|
port, //端口号
|
|
open: true,
|
|
proxy: {
|
|
//设置代理,可解决跨
|
|
'/lan': {
|
|
target: proxy,
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/lan': '/'
|
|
}
|
|
},
|
|
'/sse': {
|
|
target: "http://192.168.1.87:10409/v1",
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
//地址重写
|
|
'^/sse': '/'
|
|
}
|
|
},
|
|
},
|
|
disableHostCheck: true,
|
|
}
|
|
});
|