Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encore_entry_link_tags incorrectly querying manifest.json #230

Open
bmorg opened this issue Apr 3, 2024 · 0 comments
Open

encore_entry_link_tags incorrectly querying manifest.json #230

bmorg opened this issue Apr 3, 2024 · 0 comments

Comments

@bmorg
Copy link

bmorg commented Apr 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant