@lark-apaas/coding-template-html 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/coding-template-html",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Miaoda HTML template — single-file index.html powered by Vite",
5
5
  "type": "module",
6
6
  "files": ["template", "hooks"],
@@ -9,7 +9,7 @@ client/
9
9
  index.html # 单文件:HTML + 内联 <style> + 内联 <script type="module">
10
10
  scripts/
11
11
  build.sh # 把 client/ 下所有内容拷到 dist/output/
12
- vite.config.mjs # root: 'client',base CLIENT_BASE_PATH,挂 /dev/health
12
+ vite.config.mjs # root: 'client',allowedHosts 放开,挂 /dev/health
13
13
  package.json
14
14
  ```
15
15
 
@@ -26,9 +26,15 @@ npm run build # 把 client/ 下所有内容拷到 dist/output/
26
26
  | 变量 | 默认 | 说明 |
27
27
  |---|---|---|
28
28
  | `CLIENT_DEV_PORT` | `8001` | dev server 监听端口 |
29
- | `CLIENT_BASE_PATH` | `/` | dev server 的 base path,平台注入形如 `/app/<appid>`,访问入口变成 `http://localhost:8001/app/<appid>/` |
29
+
30
+ vite 不再读 `CLIENT_BASE_PATH`:沙箱外部 URL 的 `/app/<appid>` prefix 由平台网关
31
+ 独家负责,dev server 自己再设 `base` 会跟网关叠加,导致需要 `/app/<id>/app/<id>/`
32
+ 两层才能访问。
30
33
 
31
34
  ## Dev server endpoints
32
35
 
33
- - `<base>/` → `client/index.html`(HMR 已启用)
34
- - `/dev/health` → `{ "ready": true }`(独立于 base 的探活接口)
36
+ - `/` → `client/index.html`(HMR 已启用)
37
+ - `/dev/health` → `{ "ready": true }`(探活接口)
38
+
39
+ 沙箱网关接入时外部访问 `https://<host>/app/<appid>/`,网关把 `/app/<appid>` prefix
40
+ 剥掉转给 vite,vite 这边只看到根路径。
@@ -1,7 +1,5 @@
1
1
  import { defineConfig } from 'vite';
2
2
 
3
- // dev server 健康检查:dev server 起来后 GET /dev/health → { ready: true }
4
- // 路径独立于 base,方便外部探活。
5
3
  function devHealthCheckPlugin() {
6
4
  return {
7
5
  name: 'dev-health-check',
@@ -17,12 +15,10 @@ function devHealthCheckPlugin() {
17
15
 
18
16
  export default defineConfig({
19
17
  root: 'client',
20
- // 平台注入 CLIENT_BASE_PATH=/app/<appid>(参考 vite-react 模板 build.sh),
21
- // 没注入时 fallback 到根路径,本地 npm run dev 直接 http://localhost:8001/ 即可。
22
- base: process.env.CLIENT_BASE_PATH || '/',
23
18
  server: {
24
19
  host: '0.0.0.0',
25
20
  port: Number(process.env.CLIENT_DEV_PORT) || 8001,
21
+ allowedHosts: true,
26
22
  },
27
23
  plugins: [devHealthCheckPlugin()],
28
24
  });