Fix polyfills naming and tag missing a source (#34768)

This commit is contained in:
Renaud Chaput 2025-05-22 14:54:47 +02:00 committed by GitHub
parent 12c8a6498c
commit ef1bf8e9f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 6 deletions

View file

@ -120,10 +120,12 @@ module ViteRails::TagHelpers::IntegrityExtension
# Ignore this error, it is not critical if the file is not preloaded
end
def vite_polyfill_tag(**)
entry = vite_manifest.path_and_integrity_for('polyfill', type: :virtual)
def vite_polyfills_tag(crossorigin: 'anonymous', **)
return if ViteRuby.instance.dev_server_running?
javascript_include_tag(type: 'module', src: entry[:path], integrity: entry[:integrity], **)
entry = vite_manifest.path_and_integrity_for('polyfills', type: :virtual)
javascript_include_tag(entry[:path], type: 'module', integrity: entry[:integrity], crossorigin: crossorigin, **)
end
end