From 49f93022d5fce599814d264b95790a7f0d167af4 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 28 May 2023 20:07:04 -0400 Subject: [PATCH] Increasing priority of pass to remove before Twig tries to use it --- src/WebpackEncoreBundle.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/WebpackEncoreBundle.php b/src/WebpackEncoreBundle.php index 3a6be80a..1efa5c45 100644 --- a/src/WebpackEncoreBundle.php +++ b/src/WebpackEncoreBundle.php @@ -9,6 +9,7 @@ namespace Symfony\WebpackEncoreBundle; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\WebpackEncoreBundle\DependencyInjection\Compiler\RemoveStimulusServicesPass; @@ -17,6 +18,7 @@ final class WebpackEncoreBundle extends Bundle { public function build(ContainerBuilder $container) { - $container->addCompilerPass(new RemoveStimulusServicesPass()); + // run before TwigEnvironmentPass to remove the twig extension before it's used + $container->addCompilerPass(new RemoveStimulusServicesPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); } }