Skip to content

Commit b22f685

Browse files
committed
Fixed issue with invalid cache keys for builds
1 parent 436f4d3 commit b22f685

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/DependencyInjection/WebpackEncoreExtension.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
final class WebpackEncoreExtension extends Extension
2222
{
23+
private const ENTRYPOINTS_FILE_NAME = 'entrypoints.json';
24+
2325
public function load(array $configs, ContainerBuilder $container)
2426
{
2527
$loader = new XmlFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config'));
@@ -32,11 +34,11 @@ public function load(array $configs, ContainerBuilder $container)
3234
'_default' => $this->entrypointFactory($container, '_default', $config['output_path'], $config['cache']),
3335
];
3436
$cacheKeys = [
35-
'_default' => $config['output_path'].'/entrypoints.json',
37+
'_default' => $config['output_path'].'/'.self::ENTRYPOINTS_FILE_NAME,
3638
];
3739
foreach ($config['builds'] as $name => $path) {
3840
$factories[$name] = $this->entrypointFactory($container, $name, $path, $config['cache']);
39-
$cacheKeys[rawurlencode($name)] = $path;
41+
$cacheKeys[rawurlencode($name)] = $path.'/'.self::ENTRYPOINTS_FILE_NAME;
4042
}
4143

4244
$container->getDefinition('webpack_encore.entrypoint_lookup.cache_warmer')
@@ -49,7 +51,7 @@ public function load(array $configs, ContainerBuilder $container)
4951
private function entrypointFactory(ContainerBuilder $container, string $name, string $path, bool $cacheEnabled): Reference
5052
{
5153
$id = sprintf('webpack_encore.entrypoint_lookup[%s]', $name);
52-
$arguments = [$path.'/entrypoints.json', $cacheEnabled ? new Reference('webpack_encore.cache') : null, $name];
54+
$arguments = [$path.'/'.self::ENTRYPOINTS_FILE_NAME, $cacheEnabled ? new Reference('webpack_encore.cache') : null, $name];
5355
$container->setDefinition($id, new Definition(EntrypointLookup::class, $arguments));
5456

5557
return new Reference($id);

0 commit comments

Comments
 (0)