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

Babel targets configuration for browser and node builds

Đang mở
#982 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
30/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
babel, javascript, rollup
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Start by reading the undocumented --target CLI flag and the package.json exports question, then reproduce the browser and Node builds with the shown Babel targets. Done means documenting supported configuration guidance for separate outputs and their exports; the issue names no source file or test.

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

Mô tả

For a while I have been using the following babel preset for production bundles:

        ...
        "presets": [
          [
            "@babel/preset-env",
            {
              "targets": [
                "defaults",
                "maintained node versions"
              ]
            }
          ]
        ],
        ...

This configuration seems to be incompatible with microbundle as it generates errors such as unknown Statement of type "ForOfStatement" when the source contains for (... of ...) statements. Using "presets": ["@babel/preset-env"] without specifying targets works. However, I am concerned about the compatibility achieved by such "default" builds.

What is the proper way to use microbundle to build for both the browser and for node? What's the correct babel configuration to use? I am fine with having one build for the browser and another for Node, but how should one define package.json exports in that case?

I do realize microbundle probably does the correct thing by default, but I am a bit skeptical given the existence of the --target CLI flag, for which little documentation exists.

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.