为什么构建 NextJS 后会有多个 script 标签? [英] Why are there multiple script tags after building NextJS?

查看:20
本文介绍了为什么构建 NextJS 后会有多个 script 标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行 next build,然后运行 ​​next start.它仍然一次渲染多个 JS 文件,而不是单个入口点.

I ran next build followed by next start. It's still rendering with many JS files at once instead of a singular entrypoint.

这里有什么我遗漏的吗?文档看起来好像这就是所需要的一切

Is there something I'm missing here? The docs make it seem as though this is all that's needed

推荐答案

你看到的文件是 NextJS 代码拆分成函数和框架代码,你可以在这里阅读更多内容

The files you see are NextJS code splitting into functional and framework code , you can read more about it here

https://nextjs.org/blog/next-9-2#improved-code-splitting-strategy

我在你的脑海中看到一个关于 <script 文件的评论,Next 将不理会它,因为它只是一个正在打印的标签 - 如果你需要自己的 outside接下来要服务的JS文件,放到public目录下.

I see a comment about a <script file in your head, Next will leave this alone because its just a tag being printed - if you need your own outside JS file to be served by Next, place it in the public directory.

这篇关于为什么构建 NextJS 后会有多个 script 标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆