contentlayerdev / contentlayerdev/contentlayer

Error when building with contentlayer 0.3.4 and Next.js 13 App Router

未关闭
#506 84 条评论 47 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
3.5k
派生
192
PR 合并指标
30 天内没有已合并 PR

描述

# When I run `pnpm contentlayer build`, I run into an error within node_modules and cannot resolve it.

Versions
```json
"contentlayer": "^0.3.4",
"next": "13.4.9",
```

Error Message
```
import { ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'ConsoleSpanExporter' not found. The requested module '@opentelemetry/sdk-trace-base' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@opentelemetry/sdk-trace-base';
const { ConsoleSpanExporter, SimpleSpanProcessor } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
```

贡献指南

打开贡献指南

调研方向

Start by reproducing `pnpm contentlayer build` with contentlayer 0.3.4 and Next.js 13.4.9, then trace the failing import of `@opentelemetry/sdk-trace-base` shown in the error. Check how the dependency is loaded during the build; done means the command completes without the named-export error.

由索引模型根据 Issue 内容生成。

评估

技术栈
next.js
领域
build-system, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。