-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Open
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bughtmlHTML support issuesHTML support issues
Milestone
Description
Does this issue occur when all extensions are disabled?: Yes
System:
- VS Code Version: Version: 1.74.0
- OS Version: macOS 13.0.1
Steps to Reproduce:
- Create a new HTML file
- Add two
<script type="module">
and declare a variable with the same name in both (see example code below). - Observe the red squiggly line underneath the variable names saying Cannot redeclare block-scoped variable.
When a script tag has the type
attribute set to "module"
, the source text should be treated as an ES module with it's own scope, not the global scope.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#other_differences_between_modules_and_standard_scripts
Example HTML
<!DOCTYPE html>
<script type="module">
const x = 1;
</script>
<script type="module">
const x = 2;
</script>
iliazeus, davepeck, Eghizio, xAkre and gastonmorixe
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bughtmlHTML support issuesHTML support issues