Embedded the frontend in the binary, and built it in the build script
`npm run sync` in web/ copies the build output (web/dist, from npm run build) to internal/frontend/dist, which the binary embeds. Go can't embed from outside the package's directory (web/ is also outside the Go module), hence the copy. Only dist/.gitkeep is committed, so a fresh clone still compiles, and a binary built without syncing first serves no frontend. job-search serve serves server.frontend.dir if it is set, or else the embedded build, or warns that there is no frontend. scripts/build.sh builds and syncs the frontend before building, running npm ci first for a release or when web/node_modules is missing.
This commit is contained in:
1 parent
1832ea7437
commit
5e6c011ecb
12 files changed
+104
-11
No files matched your search
@@ -179,7 +179,7 @@ The `server` section is split into a number of sub-sections:
|
||||
|
||||
| Key | Type | Default | Notes |
|
||||
|---|---|---|---|
|
||||
| `server.frontend.dir` | string | | Directory of the frontend's build output, holding `index.html`; empty: no frontend is served (there is no embedded build yet) |
|
||||
| `server.frontend.dir` | string | | Directory of the frontend's build output, holding `index.html`; empty: the build embedded in the binary (see `npm run sync` in `web/`), or no frontend if it has none |
|
||||
| `server.frontend.immutable_prefix` | string | | Where Vite emits content-hashed files, cached for a year; empty: `/assets/` |
|
||||
| `server.frontend.index_cache_control` | string | | `Cache-Control` of HTML and other files without a hash; empty: `no-cache` |
|
||||
|
||||
|
||||
Reference in new issue
Block a user