jantimon / jantimon/html-webpack-plugin

Customize type attribute of script

未关闭
#1,663 7 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
wontfix
主要语言
JavaScript
星标
10.7k
派生
1.3k
平均合并
1 分钟
30 天内合并 PR
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 摘要。