Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Dengan monorepo, Anda dapat mengatur dan mengelola beberapa project dalam satu
direktori. Panduan ini menjelaskan cara mulai men-deploy aplikasi berbasis Nx dengan
App Hosting.
Men-deploy monorepo dengan Firebase console
Dukungan monorepo disertakan dalam alur penyiapan backend grafis di Firebase
console. Saat diminta untuk memasukkan "Direktori root" di bagian "Setelan deployment", tetapkan jalur ke aplikasi yang ingin Anda deploy di dalam monorepo:
Men-deploy monorepo dengan Firebase CLI
Dukungan monorepo dibuat ke dalam alur penyiapan backend yang dipanggil oleh perintah Firebase CLI apphosting:backends:create. Setelah Anda memasuki alur ini dan menentukan repositori GitHub yang dipilih, Anda akan diminta untuk menentukan direktori root aplikasi relatif terhadap repositori Anda; pada perintah ini, teruskan jalur ke aplikasi yang ingin Anda deploy di dalam monorepo:
$ firebaseapphosting:backends:create--project[project-name]i === Import a GitHub repository✔ Connected with GitHub successfully? Which GitHub repo do you want to deploy? gh-username/nx-monorepo? Specify your app's root directory relative to your repository path/to/app
Misalnya, berikut adalah aset yang akan di-deploy dengan struktur project Nx berikut dan "target-app" sebagai aplikasi yang ingin Anda bangun dan deploy:
Direktori root aplikasi relatif terhadap repositori Anda adalah apps/target-app.
Memecahkan masalah deployment monorepo
Jika Anda tidak menentukan kolom "root directory", build akan gagal
dan menampilkan pesan bahwa
App Hosting tidak dapat menemukan project yang akan ditargetkan di dalam monorepo Nx.
Untuk aplikasi Nx + Angular, Anda harus menggunakan builder aplikasi Angular untuk membangun aplikasi. Builder aplikasi Angular ditentukan di project.json
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-06 UTC."],[],[],null,["\u003cbr /\u003e\n\nWith monorepos, you can organize and manage multiple projects in a single\ndirectory. This guide describes how to get started deploying Nx-based apps with\nApp Hosting.\n\nDeploy monorepos with the Firebase console\n\nMonorepo support is built into the graphical backend setup flow in the Firebase\nconsole. When prompted for a \"Root directory\" under \"Deployment settings,\"\nspecify the path to the application you want to deploy inside the monorepo:\n\nDeploy monorepos with the Firebase CLI\n\nMonorepo support is built into the backend setup flow invoked by the Firebase\nCLI command `apphosting:backends:create`. After you enter this flow and specify\nyour chosen GitHub repository, you are prompted to specify your app's root\ndirectory relative to your repository; at this prompt, pass the path to the\napplication you want to deploy inside the monorepo: \n\n $ firebase apphosting:backends:create --project [project-name]\n i === Import a GitHub repository\n ✔ Connected with GitHub successfully\n\n ? Which GitHub repo do you want to deploy? gh-username/nx-monorepo\n ? Specify your app's root directory relative to your repository path/to/app\n\nFor example, here are the assets that would be deployed given the following Nx\nproject structure and \"target-app\" as the application you want to build and\ndeploy: \n\n .\n ├── lib\n ├── apps\n │ └── target-app\n │ ├── project.json\n │ └── src\n │ └── ...\n ├── nx.json\n ├── package-lock.json\n └── package.json\n\nThe app's root directory relative to your repository is `apps/target-app`.\n\nTroubleshooting monorepo deployment\n\n- If you do not specify the \"root directory\" field, then the build will fail and display a message that App Hosting cannot find a project to target inside the Nx monorepo.\n- For Nx + Angular applications, you must use the [Angular application\n builder](https://angular.io/guide/esbuild) to build the application. The Angular application builder is specified in `project.json`"]]