nxtend-team / nxtend

MIT License
189 stars 42 forks source link

rxjs conflict due to multiple package.json files #462

Open tptshoe opened 3 years ago

tptshoe commented 3 years ago

My apologies if I'm not adding this issue correctly... very much a newbie here.

I've run into some trouble in an Angular/Ionic application where typescript got angry about having multiple package.json imports. Long story short, I got errors basically saying Observable is not compatible with Observable. Digging into it a little I realized it was because the first Observable was from one package, and the second was from the other (this is in reference to the extra package.json referenced in issue #410)

The fix is fairly simple:

Just add the following lines to compilerOptions.paths in tsconfig.base.json at the root of the nx workspace: "rxjs": ["node_modules/rxjs"], "rxjs/*": ["node_modules/rxjs/*"]

Abildtoft commented 3 years ago

I'm seeing the same issue, can confirm that the workaround mentioned by @tptshoe works.

corysmc commented 3 years ago

I ran into a similar issue - that only appeared as I added capacitor. Once that second node_modules folder shows up - there's conflicts in my build... so my workaround is to

  1. delete the second node_modules folder (this is generated when running cap sync) apps/my-app/node_modules folder (if it's not there yet ignore this step)
  2. build the app nx build my-app
  3. cap sync ios nx run my-app:sync --configuration=ios
  4. then open in ios nx run my-app:open --configuration=ios All works great - until the next build - (where you'll have to delete the node_modules folder).

Correct me if I'm wrong, but isn't it an nx anti-pattern to have a package.json and a node_modules folder in the project? Is there any way to get around this so that cap sync installs on the workspace level?

Radecom commented 3 years ago

Apparently, the Ionic Angular monorepos with NX publication and the Y @nxtend/capacitor were a success, as many developers are trying to move their projects to Monorepos workspaces. And that has led us to find different situations on this path.

For example, I am trying to get the plugin to work:

@codetrix-studio/capacitor-google-auth;

in an ionic-angular project inside an Nx workspace: But, once installed I get this error:

Error: Module not found: Error: Can't resolve '../../../../../capacitor.config.json'

and I had patched it by specifying the capacitor.config.json file location, but when developers work with multiple ionic projects. How are we going to patch it?

This has led me to think that maybe Capacitor needs to rethink the way to integrate the multi-projects (Monorepos) feature to the Capacitor workflow since the current way forces us to have a node_modules folder inside our project and that breaks the monkey repo approach.

derHodrig commented 3 years ago

My apologies if I'm not adding this issue correctly... very much a newbie here.

I've run into some trouble in an Angular/Ionic application where typescript got angry about having multiple package.json imports. Long story short, I got errors basically saying Observable is not compatible with Observable. Digging into it a little I realized it was because the first Observable was from one package, and the second was from the other (this is in reference to the extra package.json referenced in issue #410)

The fix is fairly simple:

Just add the following lines to compilerOptions.paths in tsconfig.base.json at the root of the nx workspace: "rxjs": ["node_modules/rxjs"], "rxjs/*": ["node_modules/rxjs/*"]

this does not solve the IDE (Webstorm) Error hint. And Webstorm is very strong. Also, it is worst-case to have a package.json in the project folder.

The Android projects do not have any AndroidManifest.xml, which is required -> is this package production ready? ATM I don't think so

The Android Projects does not have Gradle build support, which is highly recommended.

So in the end, two questions:

  1. What is the outcome of this package
  2. What is missing in the docs

currently, I don't think this package will solve our biggest problem, one code base - multiple apps - on multiple platforms...

Connections to Discussion