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

Append Hashes To Blazor Published Files #47575

Closed
1 task done
elepner opened this issue Apr 5, 2023 · 11 comments
Closed
1 task done

Append Hashes To Blazor Published Files #47575

elepner opened this issue Apr 5, 2023 · 11 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-static-web-assets Pillar: Technical Debt Priority:1 Work that is critical for the release, but we could probably ship without
Milestone

Comments

@elepner
Copy link

elepner commented Apr 5, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

When one deploys Blazor application to CDN the application sometimes fails to load because integrity check fails. That happens because there's significant delay between deployment and CDN content update. There's little room to control how the updated files propagate.

Describe the solution you'd like

The ultimate (and maybe only) solution to this problem would be to attach hash to every file name like bundlers in JS Frameworks do. It can be hash of the file or hash connected to the build itself. Here's example of Angular production build:
image
I know it's possible to implement DIY solution for that, but it's something that would be nice to have in Blazor by default for everyone.

Additional context

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Apr 5, 2023
@SteveSandersonMS
Copy link
Member

Thanks for the suggestion, @elepner.

It could be more complicated than just changing the filenames, though. If the images (etc) had their filenames changed, what would happen to code like <img src="someimage.png"/> or @include url('somefile.css') in CSS?

Would you need to change all your existing code to work with this?

@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Apr 5, 2023
@mkArtakMSFT mkArtakMSFT added this to the Backlog milestone Apr 5, 2023
@ghost
Copy link

ghost commented Apr 5, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@elepner
Copy link
Author

elepner commented Apr 6, 2023

As far as I know, modern JS bundlers are capable of tracking all dependencies, including images and replace URLs with the correct hashed ones. However, executables download is the most critical issue since the app just fails to load and there's little room for manoeuvre.

@SteveSandersonMS
Copy link
Member

The issue is that there isn't a JS bundler involved here. These references appear inside .razor files, for example, which are processed by the Razor compiler not by a JS bundler.

@elepner
Copy link
Author

elepner commented Apr 6, 2023

I fully understand that, I'm just pointing out how the other frameworks address other types of assets. It'd require from Blazor builder to keep the graph of static asset dependencies, but I suppose this feature is beyond the scope this feature request.

@ghost
Copy link

ghost commented Dec 14, 2023

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@mkArtakMSFT mkArtakMSFT added the Priority:1 Work that is critical for the release, but we could probably ship without label Jan 8, 2024
@SteveSandersonMS
Copy link
Member

@javiercn Is this a dupe of #52824? If so can we close it?

@codymullins
Copy link

+1 here, we've seen this intermittently and it's not an ideal user experience

@mkArtakMSFT
Copy link
Member

@javiercn should this be cloased already (as done) ?

@javiercn
Copy link
Member

This is now done.

@thomasbach-dk
Copy link

This is now done.

What exactly is done? Can you refer to the pull request solving this? Will this be backported to .NET 8?

I cannot find any code related to this issue - only doc related stuff:
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-static-web-assets Pillar: Technical Debt Priority:1 Work that is critical for the release, but we could probably ship without
Projects
None yet
Development

No branches or pull requests

7 participants
@SteveSandersonMS @codymullins @elepner @javiercn @thomasbach-dk @mkArtakMSFT and others