Skip to content

Commit

Permalink
valid html: nomodule flag, not type="nomodule"
Browse files Browse the repository at this point in the history
  • Loading branch information
passchn committed Mar 15, 2022
1 parent 74478ab commit a2298e5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/View/Helper/ViteScriptsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@ public function body(): string
$tags = [];
foreach ($this->manifest->getJsFiles() as $path) {

$type = Strings::contains($path, "legacy") ? "nomodule" : "module";
$tags[] = $this->Html->script($path, [
'type' => $type,
]);
$options = [];

if (Strings::contains($path, "legacy")) {
$options['nomodule'] = 'nomodule';
} else {
$options['type'] = 'module';
}

$tags[] = $this->Html->script($path, $options);
}

return implode("\n", $tags);
Expand Down

0 comments on commit a2298e5

Please sign in to comment.