Next.js Discord

Discord Forum

Cannot generate output in custom directory with output set to 'export'

Unanswered
West African Lion posted this in #help-forum
Open in Discord
West African LionOP
As per my title.

I am following this as a guide:
https://nextjs.org/docs/app/building-your-application/deploying/static-exports#configuration

Using npx next dev works nicely and my website behaves as expected.
When using npx next build, the command seems to produce meaningful and expected output:

  ▲ Next.js 14.2.2

   Creating an optimized production build ...
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
 ✓ Collecting page data
 ✓ Generating static pages (8/8)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app)                              Size     First Load JS
┌ ○ /                                    6.94 kB        93.9 kB
├ ○ /_not-found                          875 B          87.8 kB
├ ● /[postPages]                         140 B          87.1 kB
├   └ /0
├ ○ /apple-icon.png                      0 B                0 B
├ ○ /icon.png                            0 B                0 B
└ ○ /post/[post_date]/[post_title]       140 B          87.1 kB


#### Here there should be a post page generated; this might be related, but it could also be fine. ####


+ First Load JS shared by all            86.9 kB
  ├ chunks/23-cc5df843ee873cb9.js        31.4 kB
  ├ chunks/fd9d1056-2821b0f0cabcd8bd.js  53.7 kB
  └ other shared chunks (total)          1.85 kB


○  (Static)  prerendered as static content
●  (SSG)     prerendered as static HTML (uses getStaticProps)


What could be going wrong? Why the directory out is not generated, or populated, considering that this is my next.config.mjs file:

/* @type {import('next').NextConfig} */
const nextConfig = {
    pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
    output: "export",
    distDir: "out",
    images: {
        unoptimized: true,
    },
};

export default nextConfig;

?

Am I overlooking something?

0 Replies