Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Running `dev:prepare` in the root of a module behaves differently than preparing in the playground

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 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ệ
nuxt, typescript
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Bắt đầu với lệnh dev:prepare và luồng prepare của @nuxt/module-builder, sau đó tái hiện lỗi bằng dự án nuxt-module-layers-repro được liên kết. Theo dõi cách hàm thiết lập module được chạy lần đầu và cách nuxi prepare playground được chạy sau đó. Công việc được hoàn tất khi việc prepare từ thư mục gốc của module xử lý việc tìm các tệp layer nhất quán với việc prepare trong playground.

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

Mô tả

@lewebsimple pointed out an edge case where, if a module checks for the existence of a certain file, running the dev:prepare script will fail when executed from the root of the module (via @nuxt/module-builder).

Reproduction
https://github.com/lewebsimple/nuxt-module-layers-repro

const rootDirs = getLayerDirectories().map(({ root }) => root)
let discoverMePath
for (const rootDir of rootDirs) {
  if (existsSync(`${rootDir}/discover-me.txt`)) {
    discoverMePath = `${rootDir}/discover-me.txt`
    logger.info(`Found discover-me.txt in layer: ${rootDir}`)
    break
  }
}
if (!discoverMePath) {
  throw new Error('Required file discover-me.txt not found in any layer directories.')
}

Steps to reproduce

  1. run pnpm dev:prepare in the root of the project
  2. see that it fails

Additional context

This happens because the module's setup function runs initially without taking the playground directory into account, and only afterward does it run separately for the playground.

"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
Ngôn ngữ chính
TypeScript
Star
277
Fork
36
Merge trung bình
4 ngày 19 giờ
Pull request đã merge (30 ngày)
3

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

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 nuxt/module-builder

Tất cả issue của nuxt/module-builder

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.