About This HTML Issue
The defer attribute has no effect on <script> elements that have type="module" because module scripts are already deferred by default.
When a browser encounters <script type="module">, it automatically fetches the script in parallel with HTML parsing and executes it after the document has been parsed. This is the same behavior that defer provides for classic scripts. Adding defer to a module script is redundant, and the W3C validator flags it as invalid markup.
Classic scripts (<script src="...">) block HTML parsing by default. The defer attribute changes that behavior so the script loads in parallel and runs after parsing completes. Module scripts adopted this deferred behavior as their default, so the attribute is unnecessary.
The async attribute, on the other hand, does have an effect on module scripts. It causes the module to execute as soon as it finishes loading, rather than waiting for parsing to complete.
Examples
Invalid: defer on a module script
<script type="module" src="app.js" defer></script>
Valid: module script without defer
<script type="module" src="app.js"></script>
Remove the defer attribute. The script will behave exactly the same way, since module scripts are deferred by default.
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.