AlexStocks commented on code in PR #1026:
URL: https://github.com/apache/dubbo-go-pixiu/pull/1026#discussion_r3929778955


##########
admin/web/package.json:
##########
@@ -1,45 +1,32 @@
 {
-  "name": "my-project",
-  "version": "0.1.0",
+  "name": "pixiu-admin-web",
   "private": true,
+  "version": "0.1.0",
+  "type": "module",
   "scripts": {
-    "serve": "vue-cli-service serve",
-    "build": "vue-cli-service build",
-    "analyz": "npm_config_report=true yarn run build",
-    "test:unit": "vue-cli-service test:unit"
+    "dev": "vite",

Review Comment:
   [P1] Docker Compose 仍调用已删除的 Vue 启动脚本
   
   仓库的 docker-compose.yml 中 frontend 服务仍执行 `yarn run serve --host 0.0.0.0` 并映射 
8080,但这里的新 scripts 只定义了 dev/build/preview,Vite dev server 也配置为 8088。因此标准 
`docker compose up frontend` 会先因缺少 serve script 退出;即使临时替换为 dev,外部端口仍不匹配。请同步更新 
Compose 的启动命令、监听/映射端口和锁定包管理器,或提供与原部署契约兼容的 serve 脚本,并增加一次 Compose 启动冒烟测试。



##########
admin/web/vite.config.ts:
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+
+// The Admin API (gin, default :8081) does not ship a CORS middleware, so the
+// dev server proxies every backend path. GET requests on /login and /register
+// are SPA navigations and must bypass the proxy (the backend only accepts 
POST).
+const backend = 'http://127.0.0.1:8081'

Review Comment:
   [P1] 容器内的 API 代理指向了错误的 loopback
   
   Vite 在 docker-compose 的 frontend 容器内运行,而 backend 是独立容器;这里的 127.0.0.1:8081 
只会访问 frontend 容器自身。旧 Compose 设置的 VUE_APP_BACKEND_URL 对 Vite 
不生效,所以即使修正启动脚本,/login、/config、/user 等代理请求仍会 ECONNREFUSED。请使用可配置的 VITE_ 变量并在 
Compose 中默认指向 backend 服务名(或 pixiu_admin_go_backend),再用真实 Compose 网络验证一次登录/API 
请求。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to