[英]Angular2 app - Remove Render-Blocking JavaScript
I have an angular2 firebase app. 我有一个angular2 firebase应用程序。
I've noticed that when live it task 4 seconds to get 12 JavaScript libraries that I store locally in my prod build and then it shows the app. 我注意到,实时直播需要4秒钟的时间来获取12个JavaScript库,这些库我存储在本地产品中,然后显示了该应用程序。
I need to get this 4 second delay down to 2 seconds. 我需要将这4秒的延迟降低到2秒。
When I watch the sources in the console in chrome it just pauses for 4 seconds then loads. 当我在Chrome控制台中查看源代码时,它会暂停4秒钟,然后加载。 It seems to be render blocking JavaScript the correct term?
似乎是渲染阻止JavaScript的正确术语?
Things I've tried: 我尝试过的事情:
My PageSpeed Insights scoress from google: (Resource: https://developers.google.com/speed/pagespeed/insights/ ) 我对Google的PageSpeed Insights得分:(资源: https : //developers.google.com/speed/pagespeed/insights/ )
I can't use webpack. 我不能使用webpack。
I just want an easy method for showing the user interface and then load the libraries. 我只想要一种简单的方法来显示用户界面,然后加载库。
Let me know if you have any further questions. 如果您还有其他问题,请告诉我。
Angular 2 generates your user interface, so what you are asking seems impossible at first. Angular 2会生成您的用户界面,因此您最初提出的要求似乎是不可能的。 But you are in luck: the angular 2 team is working on something to help you out.
但是,您很幸运:Angular 2团队正在努力为您提供帮助。 It is actually already ready to use, but i don't think you can use it in combination with Firebase hosting.
它实际上已经可以使用了,但是我认为您不能将它与Firebase托管结合使用。 Take a look at https://universal.angular.io/ .
看看https://universal.angular.io/ 。 It allows you to render the initial view on the server side.
它允许您在服务器端呈现初始视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.