jantimon / jantimon/html-webpack-plugin

Customize type attribute of script

オープン
#1,663 コメント 7 件 リアクション 2 件 担当者 0 名 GitHub で見る
wontfix
主要言語
JavaScript
スター
10.7k
フォーク
1.3k
平均マージ
1分
マージ済み PR(30日)
1

説明

**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**

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、plugin が script 要素をどのように生成するかを追跡し、その出力を experiments.outputModule を使用する webpack.config.js の例と比較します。完了の定義が type="module" の自動処理、ユーザーが設定できる type オプション、またはその両方のどれなのかを定め、その後、生成された HTML を検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, webpack
領域
build-system, frontend
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。