แนวทางการประกอบไมโครฟรอนต์เอนด์
สำรวจวิธีหลักในการประกอบไมโครฟรอนต์เอนด์เข้าด้วยกัน ได้แก่ ขณะสร้าง ฝั่งเซิร์ฟเวอร์ และฝั่งไคลเอ็นต์ พร้อมเรียนรู้ว่าแต่ละวิธีเหมาะใช้เมื่อใด
แนวทางการประกอบไมโครฟรอนต์เอนด์ เป็นบทเรียน Micro Frontends Architecture with Module Federation ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Micro Frontends Architecture with Module Federation และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Micro Frontends Architecture with Module Federation มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
What Is Composition?
Composition is how independently built micro frontends combine into the single page a user sees — and your choice shapes performance and deployment.
Three Families of Composition
Composition strategies fall into three families: build-time, server-side, and client-side (run-time). Real systems often mix them.
Build-Time Composition
Build-time composition publishes each MFE as an npm package pulled into a container app. Simple, but it couples deploys — one change rebuilds the whole shell.
{
"dependencies": {
"@team/cart-mfe": "1.2.0",
"@team/search-mfe": "0.9.1"
}
}Server-Side Composition
Server-side composition stitches MFE fragments into one HTML response, giving fast first paint and strong SEO since the browser gets a complete page.
Server-Side Includes (SSI)
A classic technique is Server-Side Includes: include directives the web server replaces with each MFE fragment before sending the page.
<!--#include virtual="/header-mfe" -->
<main><!--#include virtual="/catalog-mfe" --></main>
<!--#include virtual="/footer-mfe" -->Edge-Side Composition
Edge-side composition assembles fragments at the CDN edge (via Edge Side Includes), pairing low latency with centralized stitching close to users.
Client-Side Composition
Client-side composition loads a thin shell, then fetches and mounts each MFE at run time. It is the most flexible approach and the base of Module Federation.
Client-Side with Web Components
One client-side technique wraps each MFE in a custom element (web component). The shell just places the tags and each MFE bootstraps itself.
<app-shell>
<product-list></product-list>
<shopping-cart></shopping-cart>
</app-shell>Trade-offs at a Glance
Each approach trades off: build-time is simplest but weak on independence, server-side nails first load and SEO, client-side maximizes team autonomy.
Choosing an Approach
Choose by priority: server-side when SEO and first paint dominate, client-side for independent deploys and dynamic loading, build-time only for slow-changing teams.
Mixing Strategies
Mature systems mix strategies: server-side render the shell and above-the-fold content, then hydrate or lazy-load interactive MFEs client-side.
Quick Check
Test your understanding of composition.
Recap
Recap: composition can be build-time (coupled), server- or edge-side (great first paint and SEO), or client-side (max independence) — and real systems blend them.
เรียนรู้ JavaScript ด้วย AI tutor — ฟรี
เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป
- คอร์ส
- 12
- บทเรียน
- 48
คำถามที่พบบ่อย
บทเรียน “แนวทางการประกอบไมโครฟรอนต์เอนด์” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “แนวทางการประกอบไมโครฟรอนต์เอนด์” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Micro Frontends Architecture with Module Federation ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Micro Frontends Architecture with Module Federation มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “แนวทางการประกอบไมโครฟรอนต์เอนด์”
สำรวจวิธีหลักในการประกอบไมโครฟรอนต์เอนด์เข้าด้วยกัน ได้แก่ ขณะสร้าง ฝั่งเซิร์ฟเวอร์ และฝั่งไคลเอ็นต์ พร้อมเรียนรู้ว่าแต่ละวิธีเหมาะใช้เมื่อใด คุณปฏิบัติ Micro Frontends Architecture with Module Federation ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Micro Frontends Architecture with Module Federation หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Micro Frontends Architecture with Module Federation บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “แนวทางการประกอบไมโครฟรอนต์เอนด์” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Micro Frontends Architecture with Module Federation นี้ได้ไหม
ได้ บทเรียน Micro Frontends Architecture with Module Federation ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- ไมโครฟรอนต์เอนด์คืออะไร
- สำรวจประโยชน์และความท้าทาย
- แนวคิดและหลักการสำคัญ
- แนวทางการประกอบไมโครฟรอนต์เอนด์