Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins with native components installed at workspace-level fail to work #24

Open
mahmoudajawad opened this issue May 16, 2021 · 9 comments

Comments

@mahmoudajawad
Copy link
Contributor

Overview

Following on this comment, it is known that NativeScript plugins installed at workspace-level, that have native components (libs) will fail to work. This is a confirmed bug as it is not the intended behaviour (as explained by Nathan).

Versions info

Nx workspace: v12.2
NS CLI: v8.0.2
NS Nx Plugin v1.0.4
OS: macOS 10.15.7
node: v15.14.0
npm: v7.7.6

More details

I created this issue to have a reference for anyone having the same issue at the moment, until it is fixed.

@mahmoudajawad
Copy link
Contributor Author

As of @nativescript/nx==2.0.1 I find that plugins work irregardless of whether installed at workspace level, or app level.
@NathanWalker

@mahmoudajawad
Copy link
Contributor Author

Found the exception! For new projects, @natuvescript/firebase would fail. That's understandable, as the plugin config step doesn't take into consideration the Nx workspace differences.

@NathanWalker
Copy link
Contributor

Interesting - @rigor789 and I had been looking into this in past couple weeks and believe there may be {N} cli adjustments needed to fully resolve but would be curious what else you have been able to determine. Ideally we do want root level package.json dep's to just get included in a {N} app build inherently if those dep's are included in the build (thus not necessarily in the nested app package but in the npm dep tree).

@mahmoudajawad
Copy link
Contributor Author

I've been testing this across current and new workspaces, and I can say for sure that workspace level plugins work fine, the only take is the setup part of any plugin--If the plugin runs a post-install script that changes anything in the app, then it fails, often silently.

Even for the scenario of Firebase plugin, what I did was to install the plugin on app level, then remove it again, keeping only the root level installation and it still worked.

@lostation
Copy link

Hi there, if I put any plugin containing some aar files at the workspace level, those aar won't be included in the build...But if a add also the declaration into local app package.json dependencies...then those aar files are added and processed...

Any progress on that ?

@mahmoudajawad
Copy link
Contributor Author

@lostation, so far this is still the same.

@fpaaske
Copy link

fpaaske commented Apr 10, 2023

@mahmoudajawad, as with @lostation, I'm using various plugins, like the Firebase ones. These are plugins that require Pods, which means they have to be installed in each app. However, I'm also using these plugins in the libs, which means I have to install the plugins ALSO in the root package.json. Is this the correct approach?

The reason I ask is that it seems to work, but I just want it confirmed. I sometimes experience issue with running the app more than once, where the generated Podfile becomes incorrect. It seems like the plugins' config is added again for each run.

@mahmoudajawad
Copy link
Contributor Author

@fpaaske i moved off Nx with NativeScript awhile back, so I can no longer confirm or deny this issue. However, it could be a good time to revisit Nx for NativeScript.

@fpaaske
Copy link

fpaaske commented Apr 20, 2023

@NathanWalker, could you shed some light on this issue and my question above?
Is it OK to keep the plugin (e.g. Firebase) in both root and app level package.json?

And do you know what could cause this error on second run of the app? A nx .. :clean solves the problem, but then it's a full rebuild and it slows down development.

...
found 0 vulnerabilities
Installing pods...

[!] Invalid `Podfile` file: syntax error, unexpected `end', expecting end-of-input.

 #  from /Users/frank/git/.../apps/nativescript-app/platforms/ios/Podfile:125
 #  -------------------------------------------
 #  # End Podfile
 >  end
 #  -------------------------------------------
'pod install' command failed.

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants