ES Modules Directory Import Not Supported

Đang mở
#907 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu bằng cách chạy pnpm build sau khi cài đặt các dependency để tái hiện lỗi. Kiểm tra packages/ui/uno.config.ts, thư mục packages/ui/theme/ và các thiết lập tsconfig.json liên quan; hoàn tất khi build hoàn thành mà không có lỗi import thư mục được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

🐛 Build Error: ES Modules Directory Import Not Supported

Problem Description

pnpm build fails with ES Modules directory import error when building the project.

Error Details

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/path/to/devtools/packages/ui/theme' is not supported resolving ES modules imported from /path/to/devtools/packages/ui/uno.config.ts

Steps to Reproduce

  1. Clone the repository
  2. Run pnpm install
  3. Run pnpm build
  4. Observe the build failure

Expected vs Actual Behavior

Expected: The build should complete successfully without errors.

Actual: Build fails with directory import error due to missing file extensions in TypeScript import statements.

Environment Information

  • Node.js: v23.11.0
  • pnpm: 10.7.0
  • OS: Mac OS 15.5

Root Cause Analysis

ES Modules require explicit file extensions in import statements, but some imports in the codebase are missing .ts extensions, particularly in the UI package's theme configuration.

Proposed Solution

1. Update TypeScript Configuration

Add the following options to tsconfig.json:

{
  "compilerOptions": {
    "allowImportingTsExtensions": true,
    "noEmit": true
  }
}
2. Fix Import Statements

Update import statements to include explicit .ts extensions where needed, especially in:

  • packages/ui/theme/ directory imports
  • Related TypeScript module imports

Impact

This affects the build pipeline and prevents successful compilation of the packages. The issue is related to ES Modules import resolution in TypeScript configuration.

Ngôn ngữ chính
TypeScript
Star
2.9k
Fork
291
Merge trung bình
2 ngày 48 phút
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vuejs/devtools

Tất cả issue của vuejs/devtools

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.