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
AOT compilation using ngtools/webpack #5952
Conversation
infinite loops ? |
check this |
But this doesnt happen in master only in this branch |
new webpack.optimize.UglifyJsPlugin({ | ||
beautify: false, | ||
comments: false, | ||
sourcMap: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sendilkumarn is this a typo? shouldnt this be sourceMap
@sendilkumarn I found the problem now need to find a fix |
@jhipster/developers I'm giving up on this I spend hours on this but couldn't get it working. here is what I did so far But the problem is that somehow its unable to find the ngfactory* files in memory. I tried different samples online https://github.com/blacksonic/angular2-aot-cli-webpack-plugin, https://github.com/seanlandsman/webpack-ngtools-blog etc, and tried to replicate the settings but no luck. I'm unable to figure out what is going wrong. I think we need an angular experts help here @jdubois do you know anyone who could help here? |
Maybe @TheLarkInn can help? |
@deepu105 not sure - the best solution would be to ask for help on Twitter, could you do a message pointing to your explanation here? I will RT it, of course. |
@jdubois btw I think this is the only thing blocking Angular out of beta |
I did a tweet |
@deepu105 what are the steps to reproduce the issue you're having? |
@manekinekko I'll push a repo with sample code now |
great. thanks. |
@manekinekko here is the repo https://github.com/deepu105/ngtools-sample
The webpack config is under the |
Hi @manekinekko did you manage to take a look at this? |
Yep, I managed to find some time yesterday evening ^^ The issue was related to the typescript configuration in
Please note that I'm using the Also, it seems that webpack has to optimize a lot of files. As a consequence, it requires a lot of memory, so I had to bump up the memory size of node before running webpack:
And the build process was abnormally long (14min) Here is the devtools report regarding the application bootstrap in AOT vs JIT AOTJIT |
@manekinekko Thanks a ton for taking the time to look into this. We were also able to get compilation working with something similar but faced the same issue of memory timeout and abnormally long build. Any idea on what would be making the build take such long? Initially, I thought it was some kind of cyclic dependency but couldn't find any. On the other hand compiling just with |
wow @manekinekko Thanks a lot for taking the time to look into this. but 14 mins :( I think we can manually compile and use it rather than using ngtools. one less pain :p |
@sendilkumarn if you have time can you clone the branch and try to do it with just |
I managed to bring the build down to 2m34s by disabling the source map in prod mode ( One intriguing thing is that processing the html and scss is what takes too long: @deepu105 The official tool for building Angular in AOT mode is the Angular Compiler which CLI is Question: I'm interested in hearing why you didn't use the Angular CLI with this generator? |
@manekinekko infact we tried #5661 |
@sendilkumarn I see. sounds fair. I'd argue however that integrating the Angular CLI would make this generator compatible with the official stack. |
@jhipster/developers So finally I got this working with reasonable build times and good performance Default app builds in Dev : An app with lot of entities (23 of our travis sample test entities) : App builds in Prod with AOT : Thats around 13 mins for huge app. But as per official docs https://angular.io/guide/aot-compiler#jit-in-development-aot-in-production its seems to be expected
I used the ngc-webpack plugin for this and thanks to sample from https://github.com/AngularClass/angular-starter @manekinekko thanks a lot for your inputs and help. WDYT of the implementation I have done? |
@sendilkumarn @jdubois please test it |
I'm gonna stop 1 of the 2 builds trigerred |
Let me have a look. @deepu105 but 4xx is slightly less than what we have now right ? |
@deepu105 Good Job 👏 Wow, finally it works but still with ~115 seconds. But as we discussed this earlier, I am fine with that. |
@sendilkumarn I was expecting that. Those 2 builds have more than 20 entities and they run the prod build. SO build will take more than 15 mins. @pascalgrimaud is it possible to increase the timeout in travis to 20 mins for these builds? |
Btw @jdubois what do you think of the build times? is it acceptable? Anyways with AOT I dont think we have any way to speed it up further(Unless there are improvements in Angular/webpack) so the more entities or front end code you have the slower the prod build would be. One more way to reduce the build time by few mins would be to disable sourcemaps in production |
Not sure we can change the timeout on Travis, but I will have a look |
@pascalgrimaud I added |
Oh nice, I didn't know this, thanks @deepu105 |
@pascalgrimaud btw I also found that Travis has an inbuilt command to retry 3 times on failure (we do that manually for protractor right?) |
exact @deepu105 |
ah ok
Thanks & Regards,
Deepu
…On Mon, Jul 3, 2017 at 9:08 AM, Pascal Grimaud ***@***.***> wrote:
exact @deepu105 <https://github.com/deepu105>
But I wanted to avoid a retry when there is a real error, only retry for
random failures with protractor
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5952 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABDlF_rKrvOTaoMwVUT39KABmu3K3X21ks5sKJNrgaJpZM4N-I-K>
.
|
@deepu105 I'm not sure that sourcemaps in prod are a good idea anyway -> yes can you remove them? Or make them optional, and disabled by default? I'm really sad to discover one more time that Angular does not work well for real apps in production, which was the whole point of switching from AngularJS. |
@jdubois source maps are disabled by default. It's commented so people can enable it if required. Maybe we can add a line of documentation regarding it in using webpack/angular page |
@deepu105 if I do a prod build of my own sample app (only 3 entities):
|
@deepu105 -> your build passed, and as far as I'm concerned this all looks OK. I tested against an "old" AngularJS 1 app, and performance isn't great (in fact it's worse!!), but it's basically working OK and I had no issue. -> let's merge this!!!!! WDYT? I'll let you push the button :-) |
@jdubois yes lets merge this. About the folders, are you talking about the build|target folder? if so they are created during AOT compile. I need to see if there is a way to remove it within webpack else after build we need to remove it using |
Please make sure the below checklist is followed for Pull Requests.
Travis tests are green
Tests are added where necessary
Coding Rules & Commit Guidelines as per our CONTRIBUTING.md document are followed
cc @sendilkumarn
This is causing some sort of infinite loop in ngc