Skip to content
Snippets Groups Projects

Issue #3269673: Warning after clearing caches

@@ -323,8 +323,13 @@ class ComponentDiscovery {
private function discoverDistAssets(string $path): array {
$extensions = ['css', 'js'];
$app_root = \Drupal::getContainer()->getParameter('app.root');
$dirname = substr(dirname(__DIR__), strlen($app_root) + 1);
$dirname = substr(dirname(__DIR__, 2), strlen($app_root) + 1);
$num = count(explode(DIRECTORY_SEPARATOR, $dirname));
// CL Components is the module owning the library definition. However, the
// actual files live wherever the component is. We need to calculate the
// relative route to the files starting from CL Component, since drupal
// assumes paths for files in libraries are relative to the module owning
// the library.
$dots = implode(DIRECTORY_SEPARATOR, array_fill(0, $num, '..'));
return array_reduce($extensions, function (array $carry, string $extension) use ($dots, $path) {
$full_path = sprintf('%s/%s', $path, $extension);
Loading