[英]why nextjs loads all pages at first load when i build
I'm using nextJS for my new website, but SEO and speed of the site is of very importance matter for me.我正在为我的新网站使用 nextJS,但网站的 SEO 和速度对我来说非常重要。 What I'm trying to do is prevent loading of extra resource files while I have no need for them.我想要做的是在我不需要它们时阻止加载额外的资源文件。 For example when I'm at the Home page, I do not need resources for faq or about page be loaded in the background.例如,当我在主页时,我不需要在后台加载常见问题或关于页面的资源。 Is there anyway I can possibly prevent these extra loads on my site?无论如何,我是否可以防止我网站上的这些额外负载?
Thank you in advance先感谢您
afaik, next.js is prefetching js bundles for the pages linked from the given one. afaik,next.js 正在为从给定页面链接的页面预取 js 包。 To disable prefetching you can use Link
with prefetch={false}
:要禁用预取,您可以将Link
与prefetch={false}
:
<Link href="/faq" prefetch={false}>
<a>FAQ</a>
</Link>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.