0Pricing
Micro Frontends Architecture with Module Federation · Pelajaran

Menjalankan dan Men-debug Aplikasi Federasi Secara Lokal

Pelajari cara memulai aplikasi host dan remote secara bersamaan, memeriksa modul federasi di peramban, dan men-debug masalah umum selama pengembangan lokal.

Menjalankan dan Men-debug Aplikasi Federasi Secara Lokal adalah pelajaran Micro Frontends Architecture with Module Federation gratis di CoddyKit. Ini adalah pelajaran 4 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar Micro Frontends Architecture with Module Federation, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Micro Frontends Architecture with Module Federation mencakup 4 pelajaran total.

Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

Local Development Setup

A federated app is really several apps. To develop, you run each remote and the host at the same time, each on its own port.

Assigning Ports

Give every app a fixed dev-server port so the host can reliably reference each remote during development.

devServer: { port: 3001 } // remote
devServer: { port: 3000 } // host

Running Everything at Once

Manually opening many terminals is tedious. A tool like concurrently starts all dev servers with one command.

"scripts": {
  "dev": "concurrently \"npm:dev:host\" \"npm:dev:remote\""
}

Pointing the Host at Remotes

During development the host references each remote by its dev-server URL plus the exposed entry file.

remotes: {
  cart: "cart@http://localhost:3001/remoteEntry.js"
}

Inspecting remoteEntry.js

Every remote exposes a remoteEntry.js manifest. Open it directly in the browser to confirm the remote is running and to see what modules it exposes.

Using Browser DevTools

In the Network tab, watch for remoteEntry.js and the exposed module chunks loading. A 404 here is the most common federation error.

Common Error: Module Not Found

The error Cannot find module cart/Widget usually means the exposed path in the remote config does not match what the host imports. Names must match exactly.

exposes: { "./Widget": "./src/Widget" } // remote
import Widget from "cart/Widget";       // host

Common Error: Shared React Twice

If React hooks throw Invalid hook call, two React copies are loading. Confirm singleton: true on React in every app config.

Hot Reload Limitations

Changes inside a remote may not hot-reload in the host automatically. Refresh the host, or restart the remote dev server, after editing exposed modules.

Logging Federation Resolution

Set verbose webpack stats or add console logs in your bootstrap to confirm which remote and shared versions resolved at run time.

console.log("loading remote cart...");
import("cart/Widget").then(m => mount(m.default));

A Local Debug Checklist

When something breaks, check in order:

  • Are all dev servers running?
  • Does remoteEntry.js load (no 404)?
  • Do exposed names match imports?
  • Is React a singleton everywhere?

Quick Check

Test your local debugging knowledge.

Recap

You learned to run and debug federated apps locally:

  • Run host and remotes together on fixed ports
  • Use concurrently for one-command startup
  • Inspect remoteEntry.js and the Network tab
  • Fix module-not-found and double-React errors
  • Follow a quick debug checklist

Smooth local debugging speeds up MFE development.

Pertanyaan yang Sering Diajukan

Apakah pelajaran “Menjalankan dan Men-debug Aplikasi Federasi Secara Lokal” gratis?

Ya — teks lengkap “Menjalankan dan Men-debug Aplikasi Federasi Secara Lokal” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Micro Frontends Architecture with Module Federation, upgrade ke CoddyKit PRO. Kursus Micro Frontends Architecture with Module Federation mencakup 4 pelajaran total.

Apa yang akan aku pelajari di “Menjalankan dan Men-debug Aplikasi Federasi Secara Lokal”?

Pelajari cara memulai aplikasi host dan remote secara bersamaan, memeriksa modul federasi di peramban, dan men-debug masalah umum selama pengembangan lokal. Kamu berlatih Micro Frontends Architecture with Module Federation dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.

Apakah aku perlu pengalaman untuk memulai Micro Frontends Architecture with Module Federation?

Tidak diperlukan pengalaman sebelumnya. Micro Frontends Architecture with Module Federation di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 4 dari 4.

Berapa lama pelajaran “Menjalankan dan Men-debug Aplikasi Federasi Secara Lokal” memakan waktu?

Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.

Bisakah aku menulis dan menjalankan kode dalam pelajaran Micro Frontends Architecture with Module Federation ini?

Ya. Setiap pelajaran Micro Frontends Architecture with Module Federation menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.

Semua pelajaran dalam kursus ini

  1. Penyiapan dan Konfigurasi Proyek
  2. Berbagi Modul dan Komponen
  3. Membangun Aplikasi Federasi Sederhana
  4. Menjalankan dan Men-debug Aplikasi Federasi Secara Lokal
← Kembali ke Micro Frontends Architecture with Module Federation