-
Notifications
You must be signed in to change notification settings - Fork 52
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
[Question] Why are all dependencies declared in package.json of a {N} app as well? #195
Comments
Show your |
After generating a nx workspace and a new NativeScript app with xplat, there are two On root:
And in
The dependencies and some of the devDependencies are declared in both of this files. As I understood it, in Nx you want to declare your dependencies only on root level if possible. |
@OliverNiebsch it is indeed strange to create an additional package.json file, but I do remember Nathan Walker saying that it's a minor thing, since it's only created because {N} needs it and the only dependencies are obtained through the root level, so it should be fine. But I am not seeing that in your case. Check if this is helpful for you: Oh, one thing, my team and I are trying to create a {N} app as well, but you have to know that there is no official support for Angular v9 at the moment, at least they have not published it in their blog, and I know there is some issue where they are tackling the problems that Ivy has with {N} in order to run by default. Correct me if I am wrong. What my team and I are doing (at the moment), since we want to create an Angular NativeScript app as well, was simply use major version 8 for our Nx workspace and used the v8 version of Xplat as well. After all, it's a best practice to sync your angular version across your whole monorepo, remind me to provide you the source for this statement if you are interested since I have it somewhere. Our rationale is that it has already been announced that v9 will not introduce features to v8, it will mainly be a huge refactor, so this is a good opportunity to start {N} projects in v8 and, when they introduce native support for V9, simply upgrade and it should be relatively hassle free. Try again using the same major version for Nx and Xplat and see if you have the same issue, in a rapid workspace that I just created, there indeed is an additional package.json file, but it's ALL dependencies from the root node_modules folder: I might be wrong though, ask any of the collaborators like NathanWalker (I do not want to tag him because he already seems really busy) to verify. P.S. My team and I are actively working on a {N} app, if you are doing the same, let's keep in touch. I am trying to build a better documentation for Xplat, since I believe in the initiative. |
we are using nx 9.3 and xplat 9.3 with angular 9 with the following .... I got this fix from Nathan. `
So far things are working well. I'm not sure when {NS} is planning to have support. I guess Angular 10 might be out first ;) We are currently working on 9 apps. let us know if things work out for you |
Thanks for your responses! One thing I want to clarify: There is no problem with my NativeScript project. It's working pretty well with the xplat architecture and even with Angular 9 when disabling the aot flag. The reason for this issue is the fact, that I was asking myself why there are so many duplicated dependency statements in the For now whenever I need a new dependency for my app, I'm confused on which level to install it. To be safe I'm always executing Maybe there are some best practices where to add general dependencies like Thanks in advance. Keep save and healthy! |
@OliverNiebsch great question. At moment Ivy does not work well with |
{N} requires having the package.json at its root, and as of Angular 9 you cant reference packages at the root level. There is some chatter that this will be addressed, but for now you have to have the dependencies in the {N} apps package.json. Its up to you if you want to remove them from the root package.json, you dont need nativescript libraries in there, but leaving them in may make it easier to revert back to referenced libraries if and when angular supports them again. Personally, I removed all nativescript plugins from root package.json and for now I am managing the dependencies separately. Slightly more cumbersome, but hopefully that will be address in angular soon. So web package, add it to root package.json. nativescript package, add it to your app's package.json. Shared package, add it to both. I have these scripts in my root:
If youre developing in web and you add some packages at root, run the first one. If you are working on your nativescript app, run the second one and you'll be sure your packages are all there. |
Here's the angular issue to track for this: |
Thanks for clarification! |
Hi there. I'm new to the nx workspace and I'm very thankful for the xplat pack!
Maybe the answer is very obvious, but I don't understand why all the Angular and NativeScript dependencies are also listed in the package.json of a newly created NativeScript app.
In my opinion one of the nx features is that all "general" dependencies are defined in the package.json on root level for all libs and apps.
Can anyone solve my thinking mistake or help my to understand this concept?
The text was updated successfully, but these errors were encountered: