microsoft / microsoft/TypeScript
`importHelpers` generates code, that is incompatible with browsers
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.3k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 132
Mô tả
Currently enabling importHelpers adds
import * as tslib_1 from "tslib";
at the top of every source file.
Such notation is not compatible with browsers. Nowadays, all modern browsers supports Ecma modules, there's no reason for writing code that assumes Node.js environment + bundler build. Code should assume "Ecma modules" environment instead. And bundlers can stop being compilers and do the work they are supposed to do - create optimized builds (if needed at all).
The change is simple, importHelpers should generate:
import * as tslib_1 from "../../../node_modules/tslib/index.js";
The path to "node_modules" should be determined at compile time of course.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách truy vết mã trình biên dịch TypeScript phát ra import tslib của importHelpers. So sánh module specifier hiện tại với đường dẫn tương thích với trình duyệt được yêu cầu, sau đó xác minh rằng import được tạo có thể được phân giải từ một môi trường Ecma modules và rằng đường dẫn node_modules được xác định tại thời điểm biên dịch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, typescript
- Lĩnh vực
- compilers
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100