javascript - 如何为 nextjs 生成源图?
问题描述
我正在为我的应用程序使用 Next.js,并且我想生成源映射来检查包大小。我按照 Next.js 上的说明进行操作:How to use source-map-explorer with Next.js
但我收到以下错误:
.next/static/chunks/styles.73849dc0d772a52b5056.js
Unable to find a source map.
See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-maps
.next/static/chunks/webpack-2ae0ca3384e062691226.js
Unable to find a source map.
See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-maps
.next/static/chunks/webpack-d9a7914a2067f7938722.js
Unable to find a source map.
See https://github.com/danvk/source-map-explorer/blob/master/README.md#generating-source-map
跨越所有 .js 块。由于某些插件,我无法真正弄清楚如何将内容直接添加到该module.exports
部分中,所以我有:
const nextConfig = {
productionBrowserSourceMaps: true,
...
我正在使用的withPlugins
模块最后包括 nextConfig 。
],
nextConfig
)
所以不确定这是把事情搞砸了还是完全是别的什么?
解决方案
对此的解决方案实际上是升级到 nextjs 版本 11。我们在版本 10 上,用于生成源映射的给定配置不起作用。
推荐阅读
- swift - 同时访问——我怎样才能找出正在访问的内容?
- json - Angular6,无法添加新数据
- python - 使用 2d 数组作为索引从 2d numpy 数组中提取元素
- dart - 如何每隔 1 秒运行一次 setState 函数
- android - Android Kotlin Firebase 实时数据库:RecyclerView 显示空结果
- arrays - Typescript - 在字符串的开头和结尾删除多个字符/获取列表 JSON 元素的属性
- python - 从 Google Custom Search API 的搜索结果中排除多个字词
- ios - Xcode 9.4:生成代码覆盖率时出错
- eclipse - 没有匹配的胶水代码
- javascript - 流,如何从混合类型转换为更具体的类型