contentlayerdev / contentlayerdev/contentlayer
Error when building with contentlayer 0.3.4 and Next.js 13 App Router
- Ngôn ngữ chính
- TypeScript
- Star
- 3.5k
- Fork
- 192
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
# 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)
```
Hướng dẫn đóng góp
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- next.js
- Lĩnh vực
- build-system, tooling
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100