#npm run build is not building pages
4 messages · Page 1 of 1 (latest)
Hi @warm oak. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Astro supports both Server-Side Rendering (SSR) and Static Site Generation (SSG). By default, Astro builds all pages into one single file called entry.mjs. However, you can configure Astro to emit a single file for each page by setting the split option to true in your build options. This can be done in your astro.config.mjs file as shown below:
// astro.config.mjs
import { defineConfig } from 'astro/config';
export default defineConfig({ build: { split: true }});
The emitted page files will be saved in the directory specified for outDir, under a newly created pages/ directory. The files inside the pages/ directory of the build will mirror the directory structure of your page files in src/pages/.
If you're still having issues, it might be due to a known bug in Astro. There are a few open issues on GitHub related to the build process, such as this one (https://github.com/withastro/astro/issues/7974) and this one (https://github.com/withastro/astro/issues/6947). You might want to check if these issues are similar to yours.
For more information, you can refer to the Astro documentation (https://docs.astro.build/en/guides/server-side-rendering/) and the Astro Configuration Reference (https://docs.astro.build/en/reference/configuration-reference/).
Sources:
- Astro Documentation - Server-Side Rendering (https://docs.astro.build/en/guides/server-side-rendering/)
- Astro Configuration Reference (https://docs.astro.build/en/reference/configuration-reference/)
- GitHub Issue - Astro experimental assets does not work with Node.js SSR adapter (https://github.com/withastro/astro/issues/7974)
- GitHub Issue - Index pages appear to be invalid according to web standards (https://github.com/withastro/astro/issues/6947)