diff --git a/package.json b/package.json index 7c4843fa..050077e8 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "private": false, "author": "kubbo", "scripts": { - "dev": "vue-cli-service serve examples/main.js", - "build": "vue-cli-service build", - "oms": "vue-cli-service serve examples/main.js --mode oms", + "dev": "rsbuild dev", + "build": "rsbuild build", + "oms": "rsbuild dev --mode oms", "sync": "node bin/appsSync.js", - "preview": "node bin/build.js && vue-cli-service serve", + "preview": "node bin/build.js && rsbuild dev", "predev": "node bin/scanApps.js", "preoms": "dotenv -e .env.oms node bin/scanApps.js" }, @@ -41,16 +41,18 @@ "@babel/plugin-proposal-logical-assignment-operators": "^7.10.4", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", "@babel/plugin-proposal-optional-chaining": "^7.10.4", - "@vue/cli-plugin-babel": "^3.6.0", - "@vue/cli-plugin-eslint": "^3.6.0", - "@vue/cli-service": "^3.6.0", + "@rsbuild/core": "^1.0.17", + "@rsbuild/plugin-babel": "^1.0.2", + "@rsbuild/plugin-sass": "^1.0.4", + "@rsbuild/plugin-vue2": "^1.0.1", + "autoprefixer": "^10.4.20", "axios": "^0.19.2", "babel-eslint": "^10.1.0", - "core-js": "^2.6.11", "dotenv-cli": "^7.4.2", "element-ui": "^2.15.9", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", + "fs-extra": "^11.2.0", "image-webpack-loader": "^6.0.0", "inquirer": "^6.5.2", "mockjs": "^1.1.0", diff --git a/public/index.html b/public/index.html index 0176e9fe..58ba2813 100644 --- a/public/index.html +++ b/public/index.html @@ -4,18 +4,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + web端应用库-展示页面 diff --git a/rsbuild.config.js b/rsbuild.config.js new file mode 100644 index 00000000..82b440eb --- /dev/null +++ b/rsbuild.config.js @@ -0,0 +1,70 @@ +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, + } +});