Skip to content

Customize type attribute of script #1663

Open
@chenxsan

Description

@chenxsan

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

As of 5.41.0, webpack will output .mjs by default when experimental ECMAScript modules support is enabled. You can see a demo here.

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

<script type='module' src=''></script>

Describe the solution you'd like

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

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

Describe alternatives you've considered

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

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions