jantimon / jantimon/html-webpack-plugin

Customize type attribute of script

Đang mở
#1,663 7 bình luận 2 reaction 0 người được giao Xem trên GitHub
wontfix
Ngôn ngữ chính
JavaScript
Star
10.7k
Fork
1.3k
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
1

Mô tả

**Is your feature request related to a problem? Please describe.**

As of [5.41.0](https://github.com/webpack/webpack/releases/tag/v5.41.0), webpack will output `.mjs` by default when experimental ECMAScript modules support is enabled. You can see a demo [here](https://stackblitz.com/edit/node-axut71?file=webpack.config.js).

I'm wondering if `html-webpack-plugin` can support customizing the `type` attribute of `script` element:

```js

```

**Describe the solution you'd like**

Add `type='module'` to `script` automatically when users enable experimental ESM support in `webpack.config.js`.

```js
module.exports = {
experiments: {
outputModule: true,
},
};
```

**Describe alternatives you've considered**

Add a `type` option so users can customize as they wish.

**Additional context**

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

Hướng nghiên cứu

Bắt đầu bằng cách lần theo cách plugin tạo phần tử script và so sánh đầu ra đó với ví dụ webpack.config.js sử dụng experiments.outputModule. Xác định liệu việc hoàn thành có nghĩa là xử lý type="module" tự động, một tùy chọn type có thể cấu hình bởi người dùng, hay cả hai, sau đó kiểm tra HTML được tạo ra.

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, webpack
Lĩnh vực
build-system, frontend
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 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
45/100

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.