Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[AssetMapper] Endless importmap dependency loop due to comment #59289

Copy link
Copy link
Closed
@cfoehrdes

Description

@cfoehrdes
Issue body actions

Symfony version(s) affected

7.1.9

Description

I have a JS dependency (ag-grid-community version 33) which contains an exceptions message in the source code telling a developer how to import itself as module. This message is picked up by AssetMapper as an import (as mentioned in the docs it can't distinguish comments or strings from actual code). This leads to asset-mapper creating an asset for ag-grid-community with a dependency to ag-grid-community and in the end to an endless loop in Symfony\Component\AssetMapper\ImportMap\ImportMapGenerator::addImplicitEntries.

How to reproduce

Add ag-grid-community to importmap.php in version 33 and load the the page.

    'ag-grid-community' => [
        'version' => '33.0.2',
    ],

Possible Solution

I am aware that it is not possible to implement a solution distinguishing comments/string from actual syntax when checking js files for dependencies. It might make sense to add a mechanism to detect and prevent endless loops if in the dependency tree a library creates a loop by referencing itself. If circular dependencies should not be broken by asset-mapper it might make sense to allow some sort of ignore, because we have no impact on the third party library and in my opinion the error message with code snippet in their ag-grid library makes totally sense and is very helpful to their users.

Additional Context

Here is a screenshot where you can see the error message in the ag-grid source producing the import:

Screenshot 2024-12-23 at 15 10 29

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.