fix(vite): temporary use legacy build in all browsers
This commit is contained in:
parent
4844f27404
commit
0e803b1f81
2 changed files with 25 additions and 6 deletions
|
@ -189,4 +189,21 @@ module ApplicationHelper
|
||||||
Rails.env.production? || ENV['VITE_LEGACY'] == 'enabled'
|
Rails.env.production? || ENV['VITE_LEGACY'] == 'enabled'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ds_vite_legacy_javascript_tag(name, asset_type: :javascript)
|
||||||
|
legacy_name = name.sub(/(\..+)|$/, '-legacy\1')
|
||||||
|
import_tag = tag(:script) do
|
||||||
|
# rubocop:disable Rails/OutputSafety
|
||||||
|
"System.import('#{vite_asset_path(legacy_name, type: asset_type)}')".html_safe
|
||||||
|
# rubocop:enable Rails/OutputSafety
|
||||||
|
end
|
||||||
|
|
||||||
|
safe_join [ds_vite_legacy_polyfill_tag, import_tag]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Internal: Renders the vite-legacy-polyfill to enable code splitting in
|
||||||
|
# browsers that do not support modules.
|
||||||
|
def ds_vite_legacy_polyfill_tag
|
||||||
|
tag(:script, nil, src: vite_asset_path('legacy-polyfills', type: :virtual))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,9 +15,14 @@
|
||||||
|
|
||||||
= vite_client_tag
|
= vite_client_tag
|
||||||
= vite_react_refresh_tag
|
= vite_react_refresh_tag
|
||||||
= vite_javascript_tag 'application'
|
- if vite_legacy?
|
||||||
- if administrateur_signed_in?
|
= ds_vite_legacy_javascript_tag 'application'
|
||||||
= vite_javascript_tag 'track-admin'
|
- if administrateur_signed_in?
|
||||||
|
= ds_vite_legacy_javascript_tag 'track-admin'
|
||||||
|
- else
|
||||||
|
= vite_javascript_tag 'application'
|
||||||
|
- if administrateur_signed_in?
|
||||||
|
= vite_javascript_tag 'track-admin'
|
||||||
|
|
||||||
= preload_link_tag(asset_url("Muli-Regular.woff2"))
|
= preload_link_tag(asset_url("Muli-Regular.woff2"))
|
||||||
= preload_link_tag(asset_url("Muli-Bold.woff2"))
|
= preload_link_tag(asset_url("Muli-Bold.woff2"))
|
||||||
|
@ -43,9 +48,6 @@
|
||||||
- if content_for?(:footer)
|
- if content_for?(:footer)
|
||||||
= content_for(:footer)
|
= content_for(:footer)
|
||||||
|
|
||||||
- if vite_legacy?
|
|
||||||
= vite_legacy_javascript_tag 'application'
|
|
||||||
|
|
||||||
= yield :charts_js
|
= yield :charts_js
|
||||||
|
|
||||||
// Container for custom turbo-stream actions
|
// Container for custom turbo-stream actions
|
||||||
|
|
Loading…
Add table
Reference in a new issue