หากคุณเคย deploy แอปพลิเคชัน Next.js มาก่อน คุณมี mental model สำหรับโมดูลนี้อยู่แล้ว: CLI ที่ขับเคลื่อน dev/build/preview, การตรวจสอบ TypeScript, ไฟล์ configuration, ระบบนิเวศ integration และ deployment target Astro แมปแบบหนึ่งต่อหนึ่งกับทุกเครื่องมือเหล่านั้น — เพียงแต่คำสั่งและชื่อไฟล์เปลี่ยนไป
| Next.js / React | สิ่งเทียบเท่าใน Astro |
|---|
next dev | astro dev |
next build | astro build |
next start | astro preview |
next lint | astro check (ตรวจสอบ type ในไฟล์ .astro) |
next.config.js | astro.config.mjs |
| Next.js plugins (webpack) | Astro integrations (@astrojs/*) |
npm install @next/bundle-analyzer | npx astro add react / npx astro add tailwind |
| Vercel / Netlify สำหรับ Next.js | Vercel / Netlify adapters สำหรับ Astro |
tsc --noEmit | astro check ครอบคลุม .astro + .ts |
| Jest / Vitest | Vitest (config เหมือนกัน; Astro ไม่มี test runner ในตัว) |
| บทเรียน | สิ่งที่คุณจะเรียนรู้ |
|---|
| Astro CLI | astro dev / build / preview / add / check; scripts ใน package.json |
| Integrations | npx astro add, astro.config.mjs, ระบบนิเวศ integration |
astro check | ตรวจสอบ type ในไฟล์ .astro, editor tooling เทียบกับ tsc/ESLint |
| Static vs SSR | output: 'static' เทียบกับ output: 'server', adapters, prerender |
| Deploy | astro build, static hosts, SSR adapters, GitHub Actions CI |
/** @type {import('next').NextConfig} */
images: { domains: ['cdn.example.com'] },
module.exports = nextConfig;
// package.json scripts (typical Next project)
// "type-check": "tsc --noEmit"
import { defineConfig } from 'astro/config';
import react from '@astrojs/react';
import tailwind from '@astrojs/tailwind';
export default defineConfig({
integrations: [react(), tailwind()],
// package.json scripts (typical Astro project)
// "build": "astro build"
// "preview": "astro preview"
// "check": "astro check"