microsoft / microsoft/TypeScript

Dynamic import breaks global onError with requirejs

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

@rbuckton đang làm issue này rồi.

Từ ngày 26/6/2019.

Needs Investigation
Ngôn ngữ chính
Go
Star
111k
Fork
14.4k
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
117

Mô tả

TypeScript Version: 3.2.2

Search Terms: dynamic import, requirejs, amd, onerror

Code

import('module').then(()=>{ /* some code*/ });

compiled to

new Promise(function (resolve_1, reject_1) {
   require(['module'], resolve_1, reject_1);
});

If require are called with 3 arguments then require.onError is not fired. Reject should be adeed only in case when we have a catch call after import.

Some propose:

//@ts-import-no-reject
import('module').then(()=>{ /* some code*/ });
new Promise(function (resolve_1) {
   require(['module'], resolve_1);
});

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

Mở hướng dẫn đóng góp

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.

Đánh giá

Issue này chưa được đánh giá.

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.