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

running vaadin:prepare-frontend using directory dependency works, but jar dependencies filter away resources #19645

Open
roeltje25 opened this issue Jun 27, 2024 · 4 comments

Comments

@roeltje25
Copy link

Description of the bug

While developing in eclipse I use a dependency library I include this project locally. when prepare-runtime runs via maven the files from META-INF/frontend/ are ALL copied to the generated/jar-resources directory. Which is great and correct and all good things. But when a colleague who has not checked out the dependency from github is doing the same thing the files are copied from the jar file. However, for some unknown reason now only css, javascript and typescript are copied along. To me this is absolutely wrong, or at least should be documented clearly somewhere logical. Now, I had to investigate and debug the maven stuff and get all the way to here:

https://github.com/vaadin/flow/blob/main/flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskCopyFrontendFiles.java#L43
which is used here
https://github.com/vaadin/flow/blob/main/flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskCopyFrontendFiles.java#L97

The use case is e.g. that I have several iconsets that are defined in svg files which are loaded in an init javascript. these all reside in a dependent library so we can share this among projects

Expected behavior

All files in the META-INF/frontend or otherwise META-INF/resources/frontend directories should be copied to generated/jar-resources on running vaadin:prepare-frontend goal in maven

Minimal reproducible example

Use a starter project add a dependent library with some frontend files which are not javascript, typscript or css, such as a svg file.

Versions

  • Vaadin / Flow version: 24.4.3
  • Java version: 21.0.3
  • OS version: Windows 11
  • IDE (if applicable): Eclipse 2024-06
@knoobie
Copy link
Contributor

knoobie commented Jun 27, 2024

All files in the META-INF/frontend or otherwise META-INF/resources/frontend directories should be copied to generated/jar-resources on running vaadin:prepare-frontend goal in maven

Note: This might not be true and can result in a potential information leakage if there for example are README.md in the folder for the development team. So this is an assumption that holds not true for every project.

@roeltje25
Copy link
Author

All files in the META-INF/frontend or otherwise META-INF/resources/frontend directories should be copied to generated/jar-resources on running vaadin:prepare-frontend goal in maven

Note: This might not be true and can result in a potential information leakage if there for example are README.md in the folder for the development team. So this is an assumption that holds not true for every project.

Although, this could be the case, it is against the conventions in e.g. maven which do not normally filter like that. And I might in fact WANT to include README.md in the frontend. If auxiliary files about the frontend directory are needed, we should include them elsewhere or explicitly ignore them in some file.

That should of course be documented, or at least the existing filtering should be documented. Regardless, in our situation we need to include svgs to load as iconsets. We want these bundled, not as regular resources. This is currently not possible....

@knoobie
Copy link
Contributor

knoobie commented Jun 30, 2024

maven which do not normally filter like that

Maven typically is not program that exposes things over the web; Vaadin on the other hand is 😉

A workaround could be to publish your svgs as npm package and include as frontend dependency.

There is also a similar feature request / pull request already open regarding a customizing; so if you are interested to create one for your use-case the team could consider it as well #19550

@mshabarov
Copy link
Contributor

TaskCopyFrontendFiles filters the resources from resource folder by WILDCARD_INCLUSIONS for JARs whereas for file system originated resources it doesn't do this filtering. Perhaps Flow should copy all the resources in both cases.

Could you please provide a ready minimal project where we can see this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔎 Investigation
Development

No branches or pull requests

3 participants