Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

ionic/cli commands in a (react based) monorepo aren't working consistently

未關閉
#4,826 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
25/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
react, typescript
領域
cli, tooling

研究方向

先使用 ionic.config.json、根目錄的 package.json 和 apps/myapp/package.json,從 Nx monorepo 根目錄重現回報的三種行為。比較 ionic serve/build 與 ionic cap 命令,並確認設定的應用程式根目錄和根目錄的 node_modules 是否以一致的方式處理;完成的條件是文件中的命令可以從 monorepo 根目錄執行,且沒有重複的相依套件。

由索引模型根據 Issue 內容生成。

描述

triage

Description:
ionic cli commands in a (react based) monorepo aren't working consistently.

Steps to Reproduce:
As per instructions, I've defined the ionic.config.json file at the root of my (Nx) monorepo, which has the following structure:

apps/
-- myapp/
dist/
-- apps/
    -- myapp/
libs/
node_modules/
ionic.config.json
package.json

This is ionic.config.json:

{
	"defaultProject": "myapp",
	"projects": {
		"reactr": {
			"name": "myapp",
			"integrations": {
				"capacitor": {}
			},
			"type": "react",
			"root": "apps/myapp"
		}
	}
}

Issues:

  1. ionic cli searches the app root for custom build scripts
    ionic serve doesn't work, as I'm not using react-scripts. Fine.
    I tried adding "ionic:serve": "npm start" to my root package.json to no avail. I had to create apps/myapp/package.json and add the scripts there. Not too bad, but not intuitive and it tooks some trial & error.

  2. ionic cap commands searches the app root for node_modules!
    ionic capacitor is searched in apps/myapp/node_modules/ instead of the root node_modules, so I've had to also add @capacitor/core and @capacitor/cli to apps/myapp/package.json, effectively duplicating these dependencies (in monorepos you want only 1 node_modules usually).

  3. ionic cap open <platform> must be launched in the app root
    While ionic serve/build work from the monorepo root, ionic cap must be launched from the app's root, despite having specified the app's root in ionic.config.json

My ionic info:

Ionic:                                                                          

   Ionic CLI       : 6.19.0 (C:\Users\andre\AppData\Roaming\nvm\v14.18.3\node_modules\@ionic\cli)
   Ionic Framework : @ionic/react 6.0.11 (C:\Users\andre\Code\reac-tr\node_modules\@ionic\react)

Capacitor:
                                                                                
   Capacitor CLI      : 3.4.3
   @capacitor/android : 3.4.3
   @capacitor/core    : 3.4.3
   @capacitor/ios     : 3.4.3

Utility:

   cordova-res : 0.15.4
   native-run  : 1.5.0

System:

   NodeJS : v14.18.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.14.15
   OS     : Windows 10

Other Information:
Nx monorepo with a react app

主要語言
TypeScript
星號
2k
分支
682
PR 合併指標
30 天內沒有已合併 PR

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ionic-team/ionic-cli 的其他 Issue

查看 ionic-team/ionic-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。