Skip to content

Commit

Permalink
Fix adding the mapped controller asset as dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonamuller committed Oct 2, 2023
1 parent fefc61e commit ba8dcad
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ public function compile(string $content, MappedAsset $asset, AssetMapperInterfac
* and mark it as a "content" dependency so that this file's contents
* will be recalculated when the contents of any controller changes.
*/
$asset->addDependency(new AssetDependency(
$mappedControllerAsset->asset,
$mappedControllerAsset->isLazy,
true,
));
if (class_exists(AssetDependency::class)) {
// Backwards compatibility with Symfony 6.3
$asset->addDependency(new AssetDependency(
$mappedControllerAsset->asset,
$mappedControllerAsset->isLazy,
true,
));
} else {
$asset->addDependency($mappedControllerAsset->asset);
}


if ($mappedControllerAsset->isLazy) {
$lazyControllers[] = sprintf('%s: () => import(%s)', json_encode($name), json_encode($relativeImportPath, \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_SLASHES));
Expand Down

0 comments on commit ba8dcad

Please sign in to comment.