gpt4 book ai didi

javascript - Aurelia:同构?

转载 作者:数据小太阳 更新时间:2023-10-29 04:05:08 28 4
gpt4 key购买 nike

据我所知,Aurelia 不支持提到的服务端渲染 here .

但问题是:是否可以通过一些技巧/解决方法来做到这一点?

最明显的想法是使用 Phantom、Nightmare.js 或其他任何工具在服务器上的 Chrome 中简单地呈现该页面并将其提供给客户端,但这很可能会导致很大的生产力问题。

谢谢!

更新

根据 Rob Eisenberg 今天(2016 年 4 月 16 日)在 FDConf 上的回应,服务器端渲染将在 2016 年实现,有一个核心团队成员正在做这件事,这个功能有一个截止日期。

最佳答案

有一个open issue for Universal/Isomorphic Aurelia你可以监控。特别是 EisenbergEffect(即 Aurelia 的创建者 Rob Eisenberg)表示,他们正在逐步努力为 Aurelia 提供通用支持。他的这篇文章提供了大部分细节:

EisenbergEffect commented on Aug 25

We are trying to lock things down within the next month. That doesn'tmean we won't add anything after that, but we need to work towardsstabilization, performance and solid documentation withoutdistractions of lots of new features for a little bit.

Primarily, "isomorphism" isn't a use case we want to tackle for theinitial v1 release. Again, that doesn't mean we won't do it later.But, we want to have a solid framework for browser-based apps as wellas phone gap and electron/nwjs desktop apps first. That was ouroriginal goal and we want to make sure we handle those scenariosbetter than any other framework or library.

After that, we've got some other features we want to do, which arevaluable in their own right, but will also take us closer toisomorphism.

  1. Enable all aurelia libraries to run on the server. This enables somenew testing scenarios, so it's valuable if only from that perspective.
  2. Once code can run on the server, we can then implement server viewcompilation. This isn't isomorphic rendering, but rather the abilityto run Aurelia's view compiler as part of your build and bundleprocess. This enables more work to be done ahead of time, as part ofyour build, and then it doesn't need to be done in the browser atruntime. So, this will improve the startup time for all apps andreduce initial render times for all components. It also will make itpossible to store compiled views in browser local cache to improveperformance of successive runs of the application.
  3. After both of thosethings are in place, then we can look at doing a full server renderfor each route. This isn't quite isomorphic in the truest sense, butit solves the SEO problem without needing 3rd party libraries. So,it's nice to have a solution there.
  4. Finally, we can then "sync" aserver pre-rendered app with a stateful Aurelia app running inbrowser, giving us 100% isomorphic support. So, those are the stages.The first two would be beneficial to all developers, even those whoare not interested in isomorphic apps. The 3rd stage can be done todaywith 3rd party libraries, so this is a nice to have for us, for thosewho don't want an extra dependency. All of that leads into 4 whichadds the final pieces.

We have already begun some of the work on 1. That might get into ourfirst release. We aren't going to push it, but it's already inprogress and we're looking for the problem areas so we can make itwork. Steps 2-4 involve significant work. Really, we are talking abouta collection of features here, each one being rather complex. So,those will probably come in stages after v1, as point releases.

We really don't want to do what Angular 2 has done. They havemassively complicated their architecture...to the point that very fewpeople will be able to understand it and developing applications withit has become much more complicated, with many nuances. We reallydon't want that, so we're focusing on the developer experience we wantfirst, then we'll come back and see about isomorphic support (yes, wealready have ideas how to do this cleanly, but want to give thoseideas some time to mature). In all of this, our goal is to be modular.So, if you don't care about isomorphism, you don't have to think orworry about it. If you do, you would install the necessary packages,agree to the "constraints" of the system and be on your way.

So, to all who are interested in this topic, I would just ask youkindly to be patient. For those who aren't interested in isomorphism,don't worry, we aren't going to brake the developer experience on you.For those of you who want it badly, you will have to wait longer andit will come in stages and in modular pieces so as not to disruptothers.

关于javascript - Aurelia:同构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34153639/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com