-
Notifications
You must be signed in to change notification settings - Fork 433
[Feature] Transition to Angular-CLI based template #539
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
Comments
Quick question, The ng-cli will output webpack config, will it not? It's nice to have for extra customisation |
It won't unfortunately, but there are ways to hack/insert rules you can do - so that you don't have to leave the CLI itself :) @mcgri For example here, I have a writeup on adding pug rules to a CLI that hasn't been ejected. It might be quite hacky, but it gets the job done 😄 I'll try to add a few more upgrades to this setup before the transition, I'm sure I'll just leave this one in a different branch - incase someone does want complete control over Webpack. |
thank you :) I will definitely play with it |
Will the ng-cli template based, output from Because one of the main reasons we are currently using this template is to do some conditions in the mark up for environments etc... which im not 100% sure how well/easy to handle with just SSR code (perhaps because i havent actually tried much yet) |
As an Angular template, it should be based on |
@MarkPieszak do we have any roadmap/milestone/project for this feature? |
I'm waiting on the team to finish up the dependency bundling issue here: angular/angular-cli#8616 I spoke with them just last week that it's very important for the ASP.NET integration so hopefully it'll get in there soon! It will help production bundle size and overall complexity (since most users won't need to touch the webpack configs) :) |
I've made a node build of my app and it was ridiculous smaller and faster than my asp.net Core one. :( I hope that this came out soon, so we can finally have service workers on our applications trought I wish I could help over there, but there's onyl waiting for now (and seeking for things where I can help). 😞 |
Yeah at the moment it's definitely more performant to just have the standalone Node server doing Angular Universal the normal way (outside of ASP.NET, and just use .NET for your Rest API endpoints/etc). I'll post as soon as I have some updates! SO so sorry for the wait guys 😢 |
Hey @MarkPieszak, seems like the team has solved the angular/angular-cli#8616 (comment) issue. So is there any news about this? 😀 |
Bundle went from 200mb~ to 4mb! 27min to 8min production build! 💯 I just get these warnings, but everything still works! WARNING in ./node_modules/@angular/core/bundles/core.umd.js
6563:23-44 Critical dependency: the request of a dependency is an expression
at ImportLazyContextDependency.getWarnings (C:\node_modules\webpack\lib\dependencies\ContextDependency.js:39:18)
at Compilation.reportDependencyErrorsAndWarnings (C:\node_modules\webpack\lib\Compilation.js:703:24)
at Compilation.finish (C:\node_modules\webpack\lib\Compilation.js:561:9)
at applyPluginsParallel.err (C:\node_modules\webpack\lib\Compiler.js:502:17)
at C:\node_modules\tapable\lib\Tapable.js:289:11
at _addModuleChain (C:\node_modules\webpack\lib\Compilation.js:507:11)
at processModuleDependencies.err (C:\node_modules\webpack\lib\Compilation.js:477:14)
at process._tickCallback (internal/process/next_tick.js:150:11)
@ ./node_modules/@angular/core/bundles/core.umd.js
@ ./ClientApp/main.server.ts
@ multi ./ClientApp/main.server.ts
WARNING in ./node_modules/@angular/core/bundles/core.umd.js
6583:23-110 Critical dependency: the request of a dependency is an expression
at ImportLazyContextDependency.getWarnings (C:\node_modules\webpack\lib\dependencies\ContextDependency.js:39:18)
at Compilation.reportDependencyErrorsAndWarnings (C:\node_modules\webpack\lib\Compilation.js:703:24)
at Compilation.finish (C:\node_modules\webpack\lib\Compilation.js:561:9)
at applyPluginsParallel.err (C:\node_modules\webpack\lib\Compiler.js:502:17)
at C:\node_modules\tapable\lib\Tapable.js:289:11
at _addModuleChain (C:\node_modules\webpack\lib\Compilation.js:507:11)
at processModuleDependencies.err (C:\node_modules\webpack\lib\Compilation.js:477:14)
at process._tickCallback (internal/process/next_tick.js:150:11)
@ ./node_modules/@angular/core/bundles/core.umd.js
@ ./ClientApp/main.server.ts
@ multi ./ClientApp/main.server.ts |
@MarkPieszak Is this in the works or are we waiting for Angular 6 & CLI v6 to hit release? |
@MarkPieszak can you please check with Angular CLI team about angular/angular-cli#8616 , the issue still exists. |
If this is still a thing, I've managed to put together a working version of an Angular + ASP.NET Core app with server-side rendering while also using the Angular CLI. I know there is interest in having the bug mentioned above addressed, but I've gotten this type of project to cooperate with Angular CLI just fine based off of the updated ASP.NET Core + Angular template. If you'd like me to, I could give this setup a go with this repo and see if I can get it to work with this kit and submit a PR. Just let me know if you'd like this and I can get on it ASAP. |
@Xoadra Please do! |
Spoke with Hans from the CLI team and we should be fine with angular/angular-cli#8616 since we can simply just not use the buildOptimizer as it wouldn't benefit us during SSR renders anyway. It'd be great to switch things over to the CLI template so that we can get everyone on the same page with Steves CLI templates 👍 |
Yup he updated the issue yesterday and I think there is some progress as well. |
Great :) |
Do I misunderstand anything? It seems like dotnet core + angular cli + ssr is official support by MS here https://docs.microsoft.com/en-us/aspnet/core/spa/angular?view=aspnetcore-2.1&tabs=visual-studio |
I think the goal was to try and merge both efforts, but it might be better to give people options - and have them seperate. I haven't spoken with Steve Sanderson in a bit, maybe I can touch base with him and talk about the future of that project and what else we can do! |
@MarkPieszak in my experience I found the new Angular CLI based template very good. The only thing what I think was missing is the ability to add Http Status code (for example 404 for not found pages), but the recent version has this ability as well. Though I am not sure about the best way to use it. |
We are using CLI to build browser and server bundles but we still using @MarkPieszak example to integrate Angular and .Net Core (SpaServices). Our journey was the following:
So, I confirm you can build project with CLI only and run it under .Net Core with the same .Net Core integration like is presented in the current repository. You don't need completely move to new MS template to run Angular Universal under .Net Core. |
@skhalipski have you tried the default template ASP.NET Core SPA template for Angular CLI projects? I think its pretty stable now. |
@naveedahmed1 I hope we will migrate to new template later. With quite big project in PROD it is not so easy to do because of the following reasons;
All these custom features are working in old template but they are not available/or it is unclear how they are working in new template. For this reason we are still in the current template of Angular/.NET integration but CLI instead of webpack. |
By Pre-rendering if you are referring to transfer state so that http requests aren't executed twice i.e. once server and then again on client. Then you may try creating an Http Interceptor like this:
For security this may help https://angular.io/guide/security Cookies management should work the way you are handling it in this template. Logs extracting from Node to .NET I'm not sure what do you mean by this. |
Hey @MarkPieszak, I've managed to create an Angular CLI project served with aspnet, build server and client bundles with angular cli, but when trying to add hot module replacement comes the trouble. Dotnet's UseWebpackDevMiddleware seems to be needing to see a webpack.config file. There is none since I use angular cli to build project, and now they depreciated ng eject and the file on node_modules. Any suggestions? |
@guidodizi It might be worth keeping these 2 separate, for those who want complete control over their build (webpack) process / etc. The nice thing is that most of the time the webpack configs included here don't have to be touched/tweaked much. I am way overdue to give this whole repo some much needed love and upgrade things & fix a few things here and there though. I've been meaning to catch up with Steve but been so busy, I'll try to have a call with him to hear what he thinks about everything! |
+1 |
Any updates on timelines for this? The currently ejected-webpack implementation is not optimal for a sample project referenced by the official angular-universal docs. |
Is there any update regarding this? |
Now that we have transitioned to 5.0, the next step is to move things to the Angular-CLI based template, which should be (almost) a drop-in replacement for most of the apps built with this template.
The best part will be webpack configuration and everything will be handled by the CLI, and we'll have MUCH better (smaller) bundles etc.
The text was updated successfully, but these errors were encountered: