next static export api warning when running next build
Answered
French Lop posted this in #help-forum
French LopOP
hi, im making a static website, so i ran
and when i run
pnpm dlx create-next-app@latest
, said yes to all prompts except "use app router" and "customize import alias", slightly modified my config:import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
reactStrictMode: true,
output: 'export',
images: {
loader: 'akamai',
path: '',
},
};
export default nextConfig;
and when i run
pnpm run build
(runs next build --turbopack
), it warns me about statically exporting it; why is this?Answered by Yi Lon Ma
if you are trying to make a static site, you can ignore those warnings.
6 Replies
French LopOP
the command appears like this because the prompt is sticky in the integrated terminal of vscodium, this is the full log for the command:
PS C:\Users\...> npm run build
> megathread@0.1.0 build
> next build --turbopack
▲ Next.js 15.5.4 (Turbopack)
✓ Linting and checking validity of types
Creating an optimized production build ...
✓ Finished writing to disk in 104ms
✓ Compiled successfully in 1832ms
✓ Collecting page data
✓ Generating static pages (3/3)
✓ Collecting build traces
⚠ Statically exporting a Next.js application via `next export` disables API routes and middleware.
This command is meant for static-only hosts, and is not necessary to make your application static.
Pages in your application without server-side data dependencies will be automatically statically exported by `next build`, including pages powered by `getStaticProps`.
Learn more: https://nextjs.org/docs/messages/api-routes-static-export
✓ Exporting (3/3)
✓ Finalizing page optimization
Route (pages) Size First Load JS
┌ ○ / 16.1 kB 113 kB
├ └ chunks/7b338cc9221585c0.css 681 B
├ /_app 0 B 96.7 kB
├ ○ /404 12.4 kB 109 kB
└ ƒ /api/hello 0 B 96.7 kB
+ First Load JS shared by all 99.8 kB
├ chunks/59a264223f4ee0c1.js 86.2 kB
└ other shared chunks (total) 13.6 kB
○ (Static) prerendered as static content
ƒ (Dynamic) server-rendered on demand
@Yi Lon Ma because of your `output:'export'`
French LopOP
oh okay well i took it from the official docs so what should i do?
@French Lop oh okay well i took it from the official docs so what should i do?
if you are trying to make a static site, you can ignore those warnings.
Answer
@Yi Lon Ma if you are trying to make a static site, you can ignore those warnings.
French LopOP
oh alright thank you