Closed Jibbarth closed 8 months ago
Can you share your composer show (at least the symfony components ?)
That'd help to understand where we missed something
Hello @smnandre,
Sure, here it is:
And you can find whole project here if you wanna go deeper.
As far as I looked, the compiler pass where the issue is thrown is coming from symplify/console-package-builder
, so not directly related to Symfony. (and this package is deprecated, i have to remove the dependency on it :sweat_smile:)
But the fact is that StimulusLoaderJavaScriptCompiler
is now loaded as service, even when we don't have asset-mapper.
Let me know if you have enough information :slightly_smiling_face:
Could you try something ? In the vendor code of the StimulusBundle, could you hard edit the following file
vendor/symfony/stimulus-bundle/src/DependencyInjection/Compiler/ RemoveAssetMapperServicesCompiler.php
And replace stimulus_loader_javascript_compiler
by loader_javascript_compiler
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('asset_mapper')) {
$container->removeDefinition('stimulus.ux_controllers_twig_runtime');
$container->removeDefinition('stimulus.asset_mapper.controllers_map_generator');
// $container->removeDefinition('stimulus.asset_mapper.stimulus_loader_javascript_compiler'); // Before
$container->removeDefinition('stimulus.asset_mapper.loader_javascript_compiler'); // After
}
}
I think this i a little bug that could fix your problem ?
Ooh I didn't see that compiler pass that remove definition 🤩. Seems to be a good catch, I will give it a try.
It does not remove it.... if the name differs from the added one 😅
Thanks @smnandre, I can confirm that is work, if I load stimulus bundle before the other one that raise the issue.
I probably didn't get the error before on 1.12 even with stimulus bundle loaded after because the service was removed in the load
method of extension, not via a compiler pass.
Hi there,
I had a strange issue running composer update, and having an upgrade for stimulus-bundle from 2.12 to 2.13.2
After upgrading, on the clear:cache, had the following issue :
After looked at the stacktrace, I inspected the compiler pass, and it seems to browse all definitions to check each one is a command, but nevermind.
I don't have yet installed asset-mapper (but I plan to :wink:)
The
StimulusLoaderJavaScriptCompiler
, which implement an interface from asset-mapper, is now loaded in a service, whereas in 2.12 it wasn't, probably thanks to the following lines :So I'm wondering if now, the asset-mapper should be a direct dependency of stimulus-bundle, or should we find a workaround to not load this service when the asset-mapper component is not installed.
I tried adding
in
config/services.php
and it seems working - for my case, and I can provide a fix PR.WDYT ?