-
-
Notifications
You must be signed in to change notification settings - Fork 240
feat(angular): v9 with ivy support #2124
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
Conversation
chore: add ngcc execution during npm prepare
chore: update deps and peer deps to 9.0.0 rc1
chore: add top plugins to Ivy example
chore: add app-wide ngcc.cofnig.js in Ivy example for all included {N} plugins
9c28348
@VladimirAmiorkov can you approve again to kick jenkins build? I cleared the lint related issues.
ElecTreeFrying
commented
May 5, 2020
+1
SmailHammour
commented
May 6, 2020
@abcfoundry @SmailHammour totally valid concerns and understandable. I can't speak for the core team as I'm not on the core team but I don't blame them for any nonresponsiveness during this time as well as in the February time frame as much was still undergoing related to Ivy. I know many companies have encountered setbacks in past couple months with the global pandemic.
All I can do is contribute to a framework I myself personally use everyday in many active and ongoing projects. As far as unanswered or pending issue reports (some I have fixed myself in my own day to day operations, of which I plan to contribute PR's when I have the time). In meantime one thing you both could do to help as a fellow community peer of mine is perhaps take 5-10 mins and grab links to the issues from core modules repo and any {N} related repo and drop them here. I'd be curious which hit you the hardest, cause you most concern and myself and all those I work with always like to assist the community in ways we can. Look forward to seeing those when you have moment to share 🤗
@NathanWalker This one for example has been open since 2018 -> #1367
cdmistman
commented
May 6, 2020
@NathanWalker This one hasn't been open for long but I'm curious if you have a patch ready NativeScript/NativeScript#8551
It was closed because the original wording of the issue was due to an issue in my own code, however I discovered another bug that's related.
@SmailHammour thanks! yep definitely familiar with that one :) - In short there's a lot of angular router paradigms that are well suited for web scenarios which don't necessarily present 1-1 in mobile scenarios and believe a lot of issues like that can often be solved by taking a good look at the overall mobile route setup and often simplifying the approach. Additionally I've been considering writing an alternate angular router for {N} which would avoid a lot of the trouble that issue represents. It's definitely an ongoing debate however the Vue integration took a similar approach where integrating the vue-router didn't make sense 1-1 and instead introduced a much simpler and vastly more stable Navigation service to handle mobile scenarios better with vastly better results.
@cdmistman Have not seen that one - thanks for raising it here; I'll be interested to dig into that one in the coming weeks. If you have an immediate blocker due to that you may could email team@nstudio.io to see if more immediate assistance could be possible.
crowmagnumb
commented
May 8, 2020
So I created a repo similar to the one @NathanWalker posted above for others who want to dabble in the move to Angular 9/Ivy. It's located here. In the master branch I was able to successfully make a simple app to display a dialog. But in the side-drawer branch I am trying to use the nativescript-ui-sidedrawer plugin and I get the "missing dependencies" problem but can't get the work-arounds to work. If anyone has any ideas on how to fix it I would love that. Happy to reciprocate with counter-help and I offer this repo up as a starting point for anyone of course.
@crowmagnumb I was seeing that too, this fixed it for me: ProgressNS/nativescript-ui-feedback#1355 (comment).
crowmagnumb
commented
May 8, 2020
@kmmccafferty96 Thanks for that! That gave me hope but then I ran into other issues that are documented in my project README and a little too wordy to recreate here. It boils down to the fact that the nativescript-ui-sidedrawer is not Ivy compatible, but disabling Ivy I still can't complie my simple little tiny project. :(
Meyer-dev
commented
May 8, 2020
via email
@Meyer-dev That's encouraging! Thank you. I do indeed have a ngcc.config.js in the root of my directory in the side-drawer branch. It might be set to DISABLED by the time you get there because I'm experimenting (its contents are below) and it doesn't seem to do anything. This is automatically seen by ngcc right, I don't have to set anything else? What do yours look like? Cheers.
module.exports = {
packages: {
"@nativescript/angular": {
entryPoints: {
".": {
override: {
main: "./index.js",
typings: "./index.d.ts"
},
ignoreMissingDependencies: true
}
}
},
"side-drawer-directives": {
entryPoints: {
".": {
override: {
main: "./side-drawer-directives.js",
typings: "./side-drawer-directives.d.ts"
},
ignoreMissingDependencies: true
}
}
}
}
};
Meyer-dev
commented
May 9, 2020
via email
I'll say up-front, because maybe we are annoying others :), if anyone would like to start a small group of some kind that we can bounce ideas and little gotchas that we all experience off each other please let me know. I would love that. We would all like to just get to coding and not dealing with setup. :) Email me at my github username at gmail.
@Meyer-dev I have made a modification based on yours mine now reads like that below. But what I get with this gcc config set is ...
ERROR in node_modules/nativescript-ui-sidedrawer/angular/side-drawer-directives.d.ts:79:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
This likely means that the library (nativescript-ui-sidedrawer/angular) which declares NativeScriptUISideDrawerModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
79 export declare class NativeScriptUISideDrawerModule {
But I get that even if I disable the ngcc.config.js file, so it doesn't appear to have any effect.
I am using nativescript-ui-sidedrawer@8.0.1 with gcc.config.js:
module.exports = {
packages: {
"@nativescript/angular": {
entryPoints: {
".": {
override: {
main: "./index.js",
typings: "./index.d.ts"
},
ignoreMissingDependencies: true
}
}
},
"nativescript-ui-sidedrawer": {
entryPoints: {
".": {
override: {
main: "./ui-sidedrawer.android.js",
typings: "./index.d.ts"
},
ignoreMissingDependencies: true
},
angular: {
override: {
main: "./side-drawer-directives.js",
typings: "./side-drawer-directives.d.ts"
},
ignoreMissingDependencies: true
}
}
}
}
};
crowmagnumb
commented
May 9, 2020
So, I switched over to my MAC to run it in the ios simulator and it works! Without any ngcc.config.js file even! So its just running android (I run under Ubuntu) that I'm getting all my issues. :( Any thoughts on that?
crowmagnumb
commented
May 11, 2020
UPDATE: If I don't set the --env.aot flag it works fine. I just need to run tns run android and then it works (also works for me on mac/ios this way too). If I add the --env.aot flag with android I get the error I posted above.
iameduardod
commented
May 15, 2020
An alternative is switching to a framework that already supports v9 https://twitter.com/LiamDeBeasi/status/1261298258506375169
crowmagnumb
commented
May 15, 2020
@iameduardod I should update here that I am now having success with the above "workaround" and would gladly help others with their transition to it as well with some of the knowledge that I've gained from this exercise. And I have intel that the workaround is very temporary and will be made permanent in a short while.
mapo80
commented
May 16, 2020
@iameduardod I should update here that I am now having success with the above "workaround" and would gladly help others with their transition to it as well with some of the knowledge that I've gained from this exercise. And I have intel that the workaround is very temporary and will be made permanent in a short while.
A migration case would be very helpful and what steps are to be followed.
thegnuu
commented
May 18, 2020
I was able to get my application working (partially) with this workaround, but we are using a custom dynamic component loader from an external url in our electron application and I want to rebuild this feature for our new NativeScript application, everything works until I want to build the angular module within our application.
If I try to use Compiler from @angular/core I receive the following error: Error: Runtime compiler is not loaded.
Has anyone an idea how to fix that?
thegnuu
commented
May 18, 2020
Never mind, I found a solution for my issue, I just had to enable Ivy in my case... I did not double check this while copying the files, since my externals modules are built with Ivy enabled the app it self of course has to be built with Ivy as well.
NidheeshMv
commented
May 19, 2020
@NathanWalker
I'm getting below error while tns run ios . All dependency packages upgraded to Angular 9
'** ERROR in The given rootPath undefined is not a file of the program **.'
Could you provide any solution to fix this
samirotiv
commented
May 22, 2020
@NathanWalker Much appreciate your effort.
It will be great if you could explain, what is currently between us and getting this PR merged and finished?
Asking because I will be happy to be involved in contributing.
This PR will be merged and published next week no later than Wednesday 👍
Published in @nativescript/angular: ~9.0.0 now. Please see here for update instructions and tips
samirotiv
commented
Jun 3, 2020
Great work! :)
This still doesn't work on a brand new code sharing project
@westlakem could you share the exact commands you’re using to create?
westlakem
commented
Jul 16, 2020
I followed the instructions on
https://docs.nativescript.org/angular/code-sharing/creating-a-new-project.html to create a shared project with SCSS. The command I ran was ng new -c=@nativescript/schematics sass-project --shared --style=scss. I attempted to fix it following some other articles, with little success. You can see my journey in stack overflow. https://stackoverflow.com/questions/62921701/unable-to-create-angular-native-shared-application/62924265#62924265
kukurt123
commented
Aug 14, 2020
Everything works fine until i installed a plugin with element-registry. i think it is the nativescript-ui-dataform. my error goes like this :::::
ERROR in The target entry-point "undefined" has missing dependencies:
- nativescript-angular/element-registry
i followed all the instruction and placed the recommended code inside ngcc.config.js still that dang error exists. -_-
@kukurt123 we’d recommend updating to Angular 10 and using UI-dataform
7.0.0 latest version as it’s ivy compatible with 10 and doesn’t need to be in ngcc.config if you just update to angular 10.
Uh oh!
There was an error while loading. Please reload this page.
I took over from where @VladimirAmiorkov left off on this pr and got things working with Ivy enabled here.
Everyone who sees this does not need to wait until this PR is merged.
You can do the following to try the new v9 by doing the following:
Modify you package.json dependencies as follows:
Then just make sure all your @angular dep's are updated to ~9.1.0, for example:
Make you are using at least 1.5.0 of nativescript-dev-webpack in devDependencies.
Add this to your package scripts:
Then clean you project completely:
Then run with the following:
Best to always use AoT all the time since Ivy works with it by default and also good to disable hmr as seems there's some other things to get hmr working with ivy.
If you end up seeing an error like this:
You can add a new file
ngcc.config.jsto the root of your project with contents like this which helps the ngcc compiler for Ivy:Then try cleaning project and rebuild/run again after adding the ngcc.config.js file.
Here's a sample project configured correctly for Angular 9 with Ivy enabled you can reference (the tns-ios and tns-android runtimes can be 6.4.0 - they are set to specific version just because those are what was installed globally but works fine with 6.4 as well):
https://github.com/vinckobb/nativescript-angular-demo
Lastly if you have a large number of plugins and are encountering too many Ivy/ngcc related issues surrounding various plugins which may not be compatible yet, you can simply set:
Modify your tsconfig.json to include this (parallel to compilerOptions):
in your tsconfig. then clean and rebuild.
That simply disables Ivy and allows you to still build and develop with Angular 9 and then once you have brought all other dependencies up to date with various complier issues, you can then reenable later 👍