Skip to content

[StimulusBundle] Dynamic controller.js doesn't update when new controllers added #961

Closed
@weaverryan

Description

@weaverryan

Hi!

If you're using StimulusBundle with asset mapper, if you add a new file to assets/controllers/, it's not seen immediately. You need to either run bin/console cache:clear or make some change to an existing controller.

This is due to AssetMapper's caching system. In https://github.com/symfony/ux/blob/2.x/src/StimulusBundle/src/AssetMapper/StimulusLoaderJavaScriptCompiler.php, we need a way to add a DirectoryResource to the resource for the asset - https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/AssetMapper/Factory/CachedMappedAssetFactory.php#L60

So, we'll need a tweak in Symfony's core then we'll need to take advantage of it.

I believe we also need to add a normal FileDependency for assets/controllers.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug Fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions