Repository navigation
Conversation
✅ Deploy Preview for device-database-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| : netlify({ | ||
| // Dev only. The adapter emulates Netlify in `astro dev`, edge functions | ||
| // need Deno which we don't have and don't use (middleware runs as a | ||
| // normal function), so skip it. | ||
| devFeatures: { | ||
| edgeFunctions: false, | ||
| images: true, | ||
| environmentVariables: false, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
i didn't realize that we were emulating the netlify adapter when running in dev mode.
now that i know, i'd argue that we shouldn't, as it is our least important target
we should instead be "emulating" the node adapter
disabling { noExternal: true } in the astro config seems to be required in order for that to work, otherwise vite errors out when it encounters cjs
in turn this requires modifying the Dockerfile to include build and include node_modules somewhat like this:
FROM node:24-alpine AS deps
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
RUN pnpm install --frozen-lockfile --prod --ignore-scriptsaaaand then further down the copy:
COPY --from=deps /app/node_modules ./node_modulesThere was a problem hiding this comment.
I wasn't sure why we needed it either so now it's gone!
In ae11786 I updated the adapter to depend on process.env.NETLIFY, removed noExternal: true, moved dependencies to dev so they don't get bundled (astro bundles its runtime into dist), updated Dockerfile based on your suggestion and the README
…eps to dev and update Dockerfile accordingly
| **Runtime config.** All app config is runtime-only: the server reads `API_AUTHORITY`, `CSR_API_AUTHORITY` and `NOINDEX` from the environment (`-e`), so a single image serves every environment — nothing is baked in at build time. `NOINDEX` defaults to `true` (no indexing) when unset; a flip takes effect on container restart (plus CDN cache TTL). Two consequences of prerendering: the client-side API authority is served by the `/config.js` endpoint rather than inlined into the HTML, and prerendered pages carry no `robots` meta tag or `X-Robots-Tag` header (they would freeze the build-time value) — `robots.txt`, which is server-rendered, remains the crawl gate for preview deploys. | ||
|
|
||
| The server listens on `HOST=0.0.0.0` and `PORT=4321` (both overridable via env vars). The runtime image ships only the bundled server output — the node build bundles all dependencies into `dist/` (`vite.ssr.noExternal`), so there is no `node_modules` in the final image. One consequence: Astro's sharp-backed `/_image` endpoint is unavailable in the container (the project doesn't use `astro:assets`, so nothing depends on it — revisit if that changes). | ||
| The server listens on `HOST=0.0.0.0` and `PORT=4321` (both overridable via env vars). The runtime image ships the server output in `dist/` plus a production-only `node_modules`. Astro and the adapter are bundled into `dist/`, so only packages the server imports at runtime belong in `dependencies`; everything else (including `astro` and build tooling) lives in `devDependencies` to keep the image small. Astro's sharp-backed `/_image` endpoint is unavailable in the container (the project doesn't use `astro:assets`, so nothing depends on it — revisit if that changes). |
Upgraded following the migration guide.
Also bumped the netlify and node adapters to their Astro 7 majors.
Changes:
experimental.cacheis now top levelcacheastro dev, including edge functions via a Deno server. We don't have Deno and don't use edge functions (middleware runs as a normal function), so I turned that part off withdevFeatures.edgeFunctions: false. It was throwing an unhandled rejection on every dev start. Dev only, the build output is the same.{" "}to existing and new links doesn't justify the tiny size improvements.