Customize type attribute of script
See original GitHub issueIs 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
HTML script type Attribute - W3Schools
Definition and Usage. The type attribute specifies the type of the script. The type attribute identifies the content between the <script> and </script>...
Read more >Custom type attribute on <script> tag - valid html?
On the site I work on, we're using <script> tags with a src attribute but with a custom type (let's call it type="text/x-custom"...
Read more >The Script element - HTML: HyperText Markup Language
This attribute specifies the URI of an external script; this can be used as an alternative to embedding a script directly within a...
Read more >HTML | <script> type Attribute - GeeksforGeeks
HTML | <script> type Attribute · Syntax: · Attribute Values: It contains a single value i.e media_type which specifies the MIME type of...
Read more >Scripts in HTML documents - W3C
Local declaration of a scripting language ... The type attribute must be specified for each SCRIPT element instance in a document. The value...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Modules are deferred automatically, so there’s no need to set one.
not stale