Skip to content

Commit 9fcbdf3

Browse files
committed
minor #1381 [Site] Load importmap polyfill conditionnaly (smnandre)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Site] Load importmap polyfill conditionnaly With importmap support now over 90% of total usage.. i think we can try something here :) Commits ------- d322b5b [Site] Load importmap polyfill conditionnaly
2 parents de99908 + d322b5b commit 9fcbdf3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ux.symfony.com/config/packages/asset_mapper.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ framework:
66
excluded_patterns:
77
- '*/assets/styles/_*.scss'
88
- '*/assets/styles/**/_*.scss'
9+
importmap_polyfill: false
910

1011
react:
1112
controllers_path: '%kernel.project_dir%/assets/build/react/controllers'

ux.symfony.com/templates/base.html.twig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
})();
2727
</script>
2828
{% block importmap %}
29+
<script>
30+
if (!(HTMLScriptElement && HTMLScriptElement.supports?.('importmap'))) {
31+
document.head.appendChild(Object.assign(document.createElement("script"),{
32+
src:"https://cdn.jsdelivr.net/npm/[email protected]/dist/es-module-shims.min.js",
33+
async:true,
34+
}));
35+
}
36+
</script>
2937
{{ importmap('app') }}
3038
{% endblock %}
3139
{% endblock %}

0 commit comments

Comments
 (0)