Skip to content

Commit ef97386

Browse files
bug symfony#61793 [AssetMapper] Prevent duplicate entries in module preloads (xDeSwa)
This PR was merged into the 6.4 branch. Discussion ---------- [AssetMapper] Prevent duplicate entries in module preloads | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT When a library in `assets/controllers.json` is configured with `"eager` (ex. **live-component** when eager), it may result in duplicate `modulepreload` entries being generated. This change ensures that each preload path is only added once, even if the same import appears multiple times. It also prevents accidental duplication in `importmap.php` if a library is mistakenly listed more than once. Commits ------- 5686512 Prevent duplicate entries in module preloads
2 parents 97c4b3e + 5686512 commit ef97386

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function render(string|array $entryPoint, array $attributes = []): string
7373
if ('css' !== $data['type']) {
7474
$importMap[$importName] = $path;
7575
if ($preload) {
76-
$modulePreloads[] = $path;
76+
$modulePreloads[$path] = $path;
7777
}
7878
} elseif ($preload) {
7979
$cssLinks[] = $path;

0 commit comments

Comments
 (0)