Skip to content

Commit 7e3b6f6

Browse files
committed
bug #213 Increasing priority of pass to remove before Twig tries to use it (weaverryan)
This PR was merged into the main branch. Discussion ---------- Increasing priority of pass to remove before Twig tries to use it Hi! In 1.17.0, a compiler pass was added to remove the Twig extension that supplies the `stimulus_` functions if StimulusBundle is installed (because it supplies those instead). However, the priority needs to be higher, else (depending on the order your bundles are installed) Twig might try to use the service *first*... and then we remove it. Results in: > The service "twig" has a dependency on a non-existent service "webpack_encore.twig_stimulus_ > extension". Did you mean this: "webpack_encore.twig_entry_files_extension"? Cheers! Commits ------- 49f9302 Increasing priority of pass to remove before Twig tries to use it
2 parents b8ff4a6 + 49f9302 commit 7e3b6f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/WebpackEncoreBundle.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace Symfony\WebpackEncoreBundle;
1111

12+
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
1213
use Symfony\Component\DependencyInjection\ContainerBuilder;
1314
use Symfony\Component\HttpKernel\Bundle\Bundle;
1415
use Symfony\WebpackEncoreBundle\DependencyInjection\Compiler\RemoveStimulusServicesPass;
@@ -17,6 +18,7 @@ final class WebpackEncoreBundle extends Bundle
1718
{
1819
public function build(ContainerBuilder $container)
1920
{
20-
$container->addCompilerPass(new RemoveStimulusServicesPass());
21+
// run before TwigEnvironmentPass to remove the twig extension before it's used
22+
$container->addCompilerPass(new RemoveStimulusServicesPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10);
2123
}
2224
}

0 commit comments

Comments
 (0)