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

Using AdditionalStaticResourceBuildItem is not always working propertly in dev-mode #39735

Closed
ia3andy opened this issue Mar 27, 2024 · 5 comments · Fixed by #39891
Closed

Using AdditionalStaticResourceBuildItem is not always working propertly in dev-mode #39735

ia3andy opened this issue Mar 27, 2024 · 5 comments · Fixed by #39891
Assignees
Labels
area/devmode help wanted Extra attention is needed kind/bug Something isn't working
Milestone

Comments

@ia3andy
Copy link
Contributor

ia3andy commented Mar 27, 2024

Describe the bug

Currently, if there is no meta-inf/resources files, then Quarkus is using a cache when instantiating the StaticHandler, when using AdditionalStaticResourceBuildItem, we don't necessarily have a meta-inf/resources at buildtime as it's generated.

This leads to caching issue as described here:
quarkiverse/quarkus-web-bundler#171

Expected behavior

Files added with AdditionalStaticResourceBuildItem shouldn't be cached in dev-mode.


The solution might be to split in to handers:

  • one for external resources (from jars like mvnpm or webjars)
  • one for local static resources (meta-inf/resources and AdditionalStaticResourceBuildItem) on which cache is disabled in dev mode
@ia3andy
Copy link
Contributor Author

ia3andy commented Apr 3, 2024

We discussed it with @cescoffier and here is the proposed solution:

Create a new GeneratedStaticResourceBuildItem(String publicPath, byte[] content), the BuildStep will take care of:

  • Creating the GeneratedResourceBuildItem and NativeImageResourceBuildItem
  • Creating the route handler:
    • dev: implement a new classpath static handler without cache (or FS if we see there are problems) with support for http compression, head and options requests...
    • prod: instantiate a vert.x static handler (they are in the generated resources so it's fine)

@ia3andy
Copy link
Contributor Author

ia3andy commented Apr 3, 2024

@ia3andy
Copy link
Contributor Author

ia3andy commented Apr 3, 2024

@mcruzdev
Copy link
Contributor

mcruzdev commented Apr 3, 2024

Can assign it to me @ia3andy ?

@ia3andy
Copy link
Contributor Author

ia3andy commented Apr 9, 2024

@mcruzdev I found a good follow issue for you :)

#39968

@quarkus-bot quarkus-bot bot added this to the 3.12 - main milestone Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devmode help wanted Extra attention is needed kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants