ionic-team / ionic-team/ionic-cli
ionic/cli commands in a (react based) monorepo aren't working consistently
- 主要言語
- TypeScript
- スター
- 2k
- フォーク
- 682
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
**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 ` 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
コントリビューションガイド
評価
この issue はまだ評価されていません。