feat: overlay

This commit is contained in:
mozzie 2023-10-09 16:16:52 +08:00
parent 7877259057
commit 90b9a17fd0
4 changed files with 31 additions and 27 deletions

39
.vscode/tasks.json vendored
View File

@ -15,7 +15,7 @@
"dicom", "dicom",
"dmp-gateway", "dmp-gateway",
"aorta-gateway", "aorta-gateway",
"cert-gateway", "cert-gateway"
] ]
}, },
{ {
@ -32,19 +32,20 @@
"type": "shell", "type": "shell",
"command": "pnpm", "command": "pnpm",
"args": [ "args": [
"dev:logger", "dev:logger"
], ]
}, },
{ {
"label": "aorta-web", "label": "aorta-web",
"type": "shell", "type": "shell",
"command": "pnpm", "command": "pnpm",
"args": [ "args": [
"dev:aorta-web", "dev:aorta-web"
], ],
"dependsOn": [ "dependsOn": [
"build:pkg" "build:pkg"
] ],
"problemMatcher": []
}, },
{ {
"label": "cert-web", "label": "cert-web",
@ -62,7 +63,7 @@
"type": "shell", "type": "shell",
"command": "pnpm", "command": "pnpm",
"args": [ "args": [
"dev:dmp-web", "dev:dmp-web"
], ],
"dependsOn": [ "dependsOn": [
"build:pkg" "build:pkg"
@ -73,27 +74,27 @@
"type": "shell", "type": "shell",
"command": "pnpm", "command": "pnpm",
"args": [ "args": [
"dev:dmp-archive", "dev:dmp-archive"
], ],
"dependsOrder": "sequence", "dependsOrder": "sequence"
}, },
{ {
"label": "dicom", "label": "dicom",
"type": "shell", "type": "shell",
"command": "pnpm", "command": "pnpm",
"args": [ "args": [
"dev:dicom", "dev:dicom"
], ],
"dependsOrder": "sequence", "dependsOrder": "sequence"
}, },
{ {
"label": "cert-authorize", "label": "cert-authorize",
"type": "shell", "type": "shell",
"command": "pnpm", "command": "pnpm",
"args": [ "args": [
"dev:authorize", "dev:authorize"
], ],
"dependsOrder": "sequence", "dependsOrder": "sequence"
}, },
{ {
"label": "cert-authenticate", "label": "cert-authenticate",
@ -102,7 +103,7 @@
"args": [ "args": [
"dev:authenticate" "dev:authenticate"
], ],
"dependsOrder": "sequence", "dependsOrder": "sequence"
}, },
{ {
"label": "cert-gateway", "label": "cert-gateway",
@ -111,25 +112,25 @@
"args": [ "args": [
"dev:cert-gateway" "dev:cert-gateway"
], ],
"dependsOrder": "sequence", "dependsOrder": "sequence"
}, },
{ {
"label": "dmp-gateway", "label": "dmp-gateway",
"type": "shell", "type": "shell",
"command": "pnpm", "command": "pnpm",
"args": [ "args": [
"dev:dmp-gateway", "dev:dmp-gateway"
], ],
"dependsOrder": "sequence", "dependsOrder": "sequence"
}, },
{ {
"label": "aorta-gateway", "label": "aorta-gateway",
"type": "shell", "type": "shell",
"command": "pnpm", "command": "pnpm",
"args": [ "args": [
"dev:aorta-gateway", "dev:aorta-gateway"
], ],
"dependsOrder": "sequence", "dependsOrder": "sequence"
}, }
] ]
} }

View File

@ -35,7 +35,8 @@
"@babel/preset-env": "^7.21.5", "@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6", "@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5", "@babel/preset-typescript": "^7.21.5",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10", "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
"react-refresh": "0.14.0",
"@types/node": "18.16.3", "@types/node": "18.16.3",
"@types/react": "^18.0.28", "@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11", "@types/react-dom": "^18.0.11",
@ -57,7 +58,6 @@
"mini-css-extract-plugin": "^2.7.5", "mini-css-extract-plugin": "^2.7.5",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"purgecss-webpack-plugin": "^5.0.0", "purgecss-webpack-plugin": "^5.0.0",
"react-refresh": "^0.14.0",
"speed-measure-webpack-plugin": "^1.5.0", "speed-measure-webpack-plugin": "^1.5.0",
"style-loader": "^3.3.2", "style-loader": "^3.3.2",
"terser-webpack-plugin": "^5.3.7", "terser-webpack-plugin": "^5.3.7",

View File

@ -7,14 +7,14 @@ import baseConfig from "./webpack.common";
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin"; import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin"); const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
import { proxyMap } from "./dev.proxy"; import { proxyMap } from "./dev.proxy";
/** /**
* tab * tab
* create-react-app * create-react-app
* https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/openChrome.applescript * https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/openChrome.applescript
* webpack-dev-server的配置中的自动打开 open: false * webpack-dev-server的配置中的自动打开 open: false
*/ */
const openBrowser = require("./util/openBrowser");
// import openBrowser from "./util/openBrowser";
interface Configuration extends WebpackConfiguration { interface Configuration extends WebpackConfiguration {
devServer?: WebpackDevServerConfiguration; devServer?: WebpackDevServerConfiguration;
@ -35,7 +35,7 @@ const devConfig: Configuration = merge(baseConfig, {
devtool: "eval-cheap-module-source-map", devtool: "eval-cheap-module-source-map",
stats: "errors-only", stats: "errors-only",
plugins: [ plugins: [
new ReactRefreshWebpackPlugin(), // 添加热更新插件 new ReactRefreshWebpackPlugin({ overlay: false }), // 添加热更新插件
new FriendlyErrorsWebpackPlugin(), new FriendlyErrorsWebpackPlugin(),
], ],
}); });
@ -54,13 +54,16 @@ const devServer = new WebpackDevServer(
}, },
headers: { "Access-Control-Allow-Origin": "*" }, headers: { "Access-Control-Allow-Origin": "*" },
proxy: proxyMap, proxy: proxyMap,
client: {
progress: true,
},
}, },
webpack(devConfig) webpack(devConfig)
); );
devServer.start().then(() => { devServer.start().then(() => {
// 启动界面 // 启动界面
openBrowser(`http://${host}:${port}`); // openBrowser(`http://${host}:${port}`);
}); });
export default devConfig; export default devConfig;

View File

@ -91,7 +91,7 @@ importers:
specifier: ^7.21.5 specifier: ^7.21.5
version: 7.21.5(@babel/core@7.21.8) version: 7.21.5(@babel/core@7.21.8)
'@pmmmwh/react-refresh-webpack-plugin': '@pmmmwh/react-refresh-webpack-plugin':
specifier: ^0.5.10 specifier: 0.5.10
version: 0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.13.3)(webpack@5.75.0) version: 0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.13.3)(webpack@5.75.0)
'@types/js-cookie': '@types/js-cookie':
specifier: 3.0.3 specifier: 3.0.3
@ -163,7 +163,7 @@ importers:
specifier: ^5.0.0 specifier: ^5.0.0
version: 5.0.0(webpack@5.75.0) version: 5.0.0(webpack@5.75.0)
react-refresh: react-refresh:
specifier: ^0.14.0 specifier: 0.14.0
version: 0.14.0 version: 0.14.0
speed-measure-webpack-plugin: speed-measure-webpack-plugin:
specifier: ^1.5.0 specifier: ^1.5.0