Next.js ndhukung pirang-pirang target deployment, sing dikontrol sebagian dening konfigurasi output. Pilihan sing bener gumantung marang apa kowe butuh server Node, container, utawa hosting statis murni.
Mode output build
. = {
};
Next.js ndhukung pirang-pirang target deployment, sing dikontrol sebagian dening konfigurasi output. Pilihan sing bener gumantung marang apa kowe butuh server Node, container, utawa hosting statis murni.
. = {
};
Mlayu server Node.js, mula kowe entuk kabeh: SSR, ISR, Server Actions, Route Handlers, optimisasi gambar, middleware. Iki apa sing digunakake platform kaya Vercel (pembuat Next.js, zero-config) lan host Node.
# Next traces only the needed files into .next/standalone → a tiny, self-contained server
COPY --from=builder /app/.next/standalone ./
CMD ["node", "server.js"]
standalone ngasilake folder minimal sing mung ngandhut dependensi sing bener-bener digunakake, ideal kanggo image Docker cilik ing AWS, GCP, server dhewe, lsp. Kowe tetep njaga kabeh fitur server.
next build → out/ (plain HTML/CSS/JS, deployable to any static host: S3, GitHub Pages, Netlify CDN)
Ekspor statis menehi hosting paling murah lan paling gampang nanging mateni fitur server: ora ana SSR, ora ana ISR, ora ana Route Handlers, ora ana Server Actions, ora ana optimisasi gambar ing-the-fly. Cocog mung kanggo situs statis sepenuhnya.
Need SSR/ISR/Server Actions, want zero-config → Vercel (or a Node host) — default output
Want containers / self-host with full features → output: "standalone" + Docker
Purely static content (docs, marketing) → output: "export" → any static CDN
- Runtime choice (Edge vs Node) affects where functions run
- Self-hosting ISR/caching needs persistent storage or a shared cache
- Image optimization on non-Vercel hosts may need a custom loader
Deployment ora siji ukuran kanggo kabeh: mode output nemtokake fitur Next.js apa sing bisa isih urip.
Wawas yen output default/Node njaga kabeh kemampuan server, standalone ngapakake kanggo Docker/self-hosting, lan export nukar kabeh fitur server kanggo hosting statis murni liya, sampeyan bisa nyampur build menyang infrastruktur dhewe — lan nyingkir saka jebakan output: "export" sing mateni SSR/ISR/Server Actions kanthi tenanan.
Pustaka pitakon wawancara IT kanthi jawaban rinci — saka Junior nganti Senior.
Nyumbang