You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0d8f36f
Browse filesBrowse the repository at this point in the historyBrowse files
feat(hub): serve static builds from a deploy base (#494)
buildHub bakes root-absolute URLs for frame bases, dock entries, page
scripts, and per-SPA asset references. A deploy base prefixes them so the
same output serves under a subpath, while the on-disk deploy-root layout
stays unchanged.
title: 'DF8007: Hub Base Is Outside the Deploy Base'
3
+
description: 'buildHub''s base ("{base}") is not under its deployBase ("{deployBase}"), so the hub itself would be served outside the deploy root.'
4
+
---
5
+
6
+
## Message
7
+
8
+
> buildHub's base ("`{base}`") is not under its deployBase ("`{deployBase}`"), so the hub itself would be served outside the deploy root.
9
+
10
+
## Cause
11
+
12
+
`deployBase` is the URL prefix the whole output tree is served under, and the hub sits inside that tree. A hub `base` outside it describes a second deployment, so the baked URLs and the file layout would disagree.
13
+
14
+
## Example
15
+
16
+
```ts
17
+
// ✓ Good: the hub base includes the deploy prefix
18
+
awaitbuildHub({
19
+
outDir: 'dist/__devtools',
20
+
base: '/ci-build-123456/__devtools/',
21
+
deployBase: '/ci-build-123456/',
22
+
})
23
+
24
+
// ✗ Bad: the hub would be served at the domain root
25
+
awaitbuildHub({
26
+
outDir: 'dist/__devtools',
27
+
base: '/__devtools/',
28
+
deployBase: '/ci-build-123456/',
29
+
})
30
+
```
31
+
32
+
## Fix
33
+
34
+
Include the deploy prefix in `base`, or omit `deployBase` when the output is served at the domain root.
35
+
36
+
## Source
37
+
38
+
-[`packages/hub/src/node/build.ts`](https://github.com/devframes/devframe/blob/main/packages/hub/src/node/build.ts): `buildHub()` rejects a `base` that does not start with `deployBase`.
Copy file name to clipboardExpand all lines: docs/content/8.references/6.hub-api.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,6 +124,7 @@ The options of `buildHub()` from `@devframes/hub/build`: [Static builds](/guide/
124
124
|---|---|
125
125
|`outDir`| Output directory for the hub subtree; corresponds to `base` at serve time (build `base: '/__devframes/'` into `dist/__devframes`). A mount served outside the hub base (a devframe SPA or asset dir kept as a sibling of it) is written to this directory's parent (the deploy root) by its absolute path. |
126
126
|`base`| Mount base baked into every absolute URL the build emits. Default `/__devframes/`. |
127
+
|`deployBase`| URL prefix the deploy root is served under. Root-absolute URLs the build emits are rebased under it. Must be a prefix of `base`. Default `/`. |
127
128
|`context`| An already-mounted `DevframeHubContext` to bake instead of `devframes` (the build counterpart of `initHub({ context })`); reads `ctx.frames` and `ctx.views.buildStaticDirs`. Mutually exclusive with `devframes`. |
128
129
|`clean`| Remove `outDir` before writing. Default `true`; set `false` to bake beside an app's own build output. |
0 commit comments