Skip to content

encore_entry_link_tags incorrectly querying manifest.json #230

@bmorg

Description

@bmorg

I have encountered this while hosting a Symfony app in a subfolder and managed to reproduce it with a minimal test case.

The behavior only shows when framework.assets.strict_mode is set to true.

Error

The error thrown is: Asset "/web-subfolder/app.b75294ae.css" not found in manifest ".../build-output/manifest.json". Did you mean one of these? "my-prefix/app.css", "my-prefix/app.js"

Reproduce

To demonstrate the problem I am setting three different values for these three directories:

  • output (setOutputPath): 'build-output/'
  • web root (setPublicPath): '/web-subfolder'
  • manifest key prefix (setManifestKeyPrefix): 'my-prefix/'

manifest.json:

{
  "my-prefix/app.css": "/web-subfolder/app.b75294ae.css",
  "my-prefix/app.js": "/web-subfolder/app.53d71f57.js"
}

entrypoints.json:

{
  "entrypoints": {
    "app": {
      "js": [
        "/web-subfolder/app.53d71f57.js"
      ],
      "css": [
        "/web-subfolder/app.b75294ae.css"
      ]
    }
  }
}

Template:

{{ encore_entry_link_tags('app') }}

Fix

I'm not really sure I completely understand how all the parts work together, but it seems to me that there is no need to call getAssetPath in TagRenderer->renderWebpackLinkTags (here), since the entrypoint already provides the "mapped" values.

Demo

I have created a demo repository here. The relevant changes to reproduce are in this commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions