Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#4,826 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
cli, tooling

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện ba hành vi đã được báo cáo từ thư mục gốc của monorepo Nx bằng cách sử dụng ionic.config.json, package.json ở thư mục gốc và apps/myapp/package.json. So sánh ionic serve/build với các lệnh ionic cap và xác minh liệu app root đã cấu hình cùng node_modules ở thư mục gốc có được xử lý nhất quán hay không; hoàn thành nghĩa là các lệnh được tài liệu hóa hoạt động từ thư mục gốc của monorepo mà không có các dependency bị trùng lặp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
2k
Fork
681
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ionic-team/ionic-cli

Tất cả issue của ionic-team/ionic-cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.