#Static Export - Not producing output file despite successful build.

29 messages · Page 1 of 1 (latest)

fierce latch
#

My next config is:
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
distDir: "out",
images: {
unoptimized: true,
},
};

When I run npm run build I get:
Route (app) Size First Load JS
┌ ○ / 43.4 kB 142 kB
└ ○ /_not-found 875 B 88 kB

  • First Load JS shared by all 87.1 kB
    ├ chunks/23-93bd7f4baad7a8e2.js 31.6 kB
    ├ chunks/fd9d1056-360e5dd5b3902a99.js 53.7 kB
    └ other shared chunks (total) 1.89 kB

○ (Static) prerendered as static content

Yet, it does not produce a folder with html/css/javascript files in the specific "out" directory. What's weird though is that when I run npm run start, my website will pop up. I thought that npm run start would be using the files from the build step, so what gives???? (My next version is: "14.2.13")

uncut timberBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

fierce latch
#

I have tried searching around the docs and stack overflow for anything related to this but I haven't seemed to find anything that relates to the situation I'm in. I'll pulling my hair out over this...what's worse is that the build step was working at some point and I have no idea what changed to make it no longer produce files in the out directory.

true mango
#

So if you delete the .next folder, run the build again, you are still able to start your site with npm start?

fierce latch
#

I only deleted the out folder, let me try right now

#

Okay yeah after deleting out and .next, I can run build and then run start and it gives me my website on port 3000

true mango
#

So it's there but just hidden.

#

cd into the dir and do ls -a

#

if you're on unix

fierce latch
#

I'm on windows but I can just turn on hidden files I think

true mango
#

yeah or do dir /adh

fierce latch
#

yeah nothing new popped up (other than the .git folder)

#

Mode LastWriteTime Length Name


d----- 10/27/2024 11:43 AM .next
da---l 10/27/2024 9:55 AM node_modules
da---l 10/11/2024 10:53 AM src
-a---l 10/27/2024 10:40 AM 284 .eslintrc.json
-a---l 10/27/2024 11:01 AM 391 .gitignore
-a---l 9/27/2024 1:31 PM 419 components.json
-a---l 9/27/2024 3:07 PM 315 compose.yaml
-a---l 9/27/2024 3:33 PM 783 Dockerfile
-a---l 9/24/2024 3:34 PM 228 next-env.d.ts
-a---l 10/27/2024 11:19 AM 143 next.config.mjs
-a---- 10/27/2024 9:55 AM 222409 package-lock.json
-a---- 10/27/2024 11:04 AM 1327 package.json
-a---l 9/24/2024 3:34 PM 135 postcss.config.mjs
-a---l 9/27/2024 2:58 PM 827 README.Docker.md
-a---l 9/24/2024 3:34 PM 1450 README.md
-a---l 9/27/2024 1:31 PM 1668 tailwind.config.ts
-a---l 9/27/2024 1:28 PM 578 tsconfig.json

true mango
#

I said cd into the dir

#

so into .next

fierce latch
#

Mode LastWriteTime Length Name


d----- 10/27/2024 11:43 AM cache
d----- 10/27/2024 11:43 AM server
d----- 10/27/2024 11:43 AM static
d----- 10/27/2024 11:43 AM types
-a---- 10/27/2024 11:43 AM 1153 app-build-manifest.json
-a---- 10/27/2024 11:43 AM 82 app-path-routes-manifest.json
-a---- 10/27/2024 11:43 AM 967 build-manifest.json
-a---- 10/27/2024 11:43 AM 21 BUILD_ID
-a---- 10/27/2024 11:43 AM 94 export-marker.json
-a---- 10/27/2024 11:43 AM 511 images-manifest.json
-a---- 10/27/2024 11:43 AM 4643 next-minimal-server.js.nft.json
-a---- 10/27/2024 11:43 AM 30318 next-server.js.nft.json
-a---- 10/27/2024 11:42 AM 20 package.json
-a---- 10/27/2024 11:43 AM 959 prerender-manifest.json
-a---- 10/27/2024 11:43 AM 2 react-loadable-manifest.json
-a---- 10/27/2024 11:43 AM 4602 required-server-files.json
-a---- 10/27/2024 11:42 AM 831 routes-manifest.json
-a---- 10/27/2024 11:43 AM 504523 trace

#

The only index.html file that I can find is inside of /.next/server/app

true mango
#

I'm a bit unexperienced with static exports, but apparently next start always attempt to start your project with a server. It's weird that you're still able to do that given your next config. Are you sure you're even in the correct directory for your project?

fierce latch
#

Hahah yeah I think so, I'm just at the root of the project (where the package.json and other config files live)

true mango
#

If you can, upload your codebase to a github repo and share it here (or a minimal reproducible repo).

fierce latch
#

yeah np gimme one sec

#

Let me know how it goes 🙂

true mango
#

Ah, no wonder it didn't make any sense. You forgot to export your nextConfig.

Replace the next.config.mjs with:

/** @type {import('next').NextConfig} */
const nextConfig = {
  output: "export",
  images: {
    unoptimized: true,
  },
};

export default nextConfig;
fierce latch
#

oh boy haha

#

that fixed it

#

you are a genius

true mango
#

On the contrary, I should have picked that up by just looking at your config instead of having to clone your repo. I'll blame it on being close to bedtime 😄

fierce latch
#

haha regardless, I appreciate the help. ❤️