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

[Question] How to specify different formats for multiple exports?

Đang mở
#973 10 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
25/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, typescript
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Issue không nêu tệp hoặc test nào trong repository, nhưng có các ví dụ về exports của package.json và lệnh microbundle. Hãy bắt đầu bằng cách xem lại các ví dụ đã được ghi lại về export đơn và nhiều export; công việc được xem là hoàn tất khi đã làm rõ liệu có hỗ trợ ánh xạ format theo từng export hay không và đã ghi lại cấu hình hoặc giới hạn áp dụng.

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

Mô tả

question :grey_question:

I'm trying to setup microbundle to provide separate exports for several modules my package is exporting, like this:

{
  "name": "x",
  "type": "module",
  "version": "10.0",
  "author": "y",
  "license": "MIT",
  "devDependencies": {
    "microbundle": "^0.15.0",
    "np": "^7.6.1",
    "typescript": "^4.6.4"
  },
  "dependencies": {},
  "scripts": {
    "prepare": "microbundle ./src/one.ts ./src/two.ts"
  },
  "exports": {
    "one": "./dist/one.modern.js",
    "two": "./dist/two.modern.js"
  },
  "files": [
    "dist"
  ],
  "types": "dist/index.d.ts"
}

However, I don't know how to specify different export formats for each one of my exports.

The documentations provides either this example, which shows how to proceed when doing "single" exports:

"exports": {
  "require": "./dist/foo.cjs",
  "default": "./dist/foo.modern.js"
},

or this example, which shows an example of multiple exports, but in a single format:

"exports": {
  ".": "./dist/foo.modern.mjs",
  "./lite": "./dist/lite.modern.mjs",
  "./full": "./dist/full.modern.mjs"
},

How could I specify multiple formats like in the 1st example, while still specifying multiple named exports like in the 2nd example?

Ngôn ngữ chính
JavaScript
Star
8.1k
Fork
358
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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 developit/microbundle

Tất cả issue của developit/microbundle

Issue tương tự

Thêm issue về JavaScript

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.