From f343237dc5d6df1b3d1f2520c5bfdf247ff33448 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 19 Oct 2023 20:01:36 +0200 Subject: [PATCH] [AssetMapper] Put importmap in polyfill so it can be hosted locally easily --- frontend/asset_mapper.rst | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index 17a80af3fce..37ff51cb5d1 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -1031,15 +1031,31 @@ you expect are being included in the asset map. ``framework.asset_mapper.importmap_polyfill`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Configure the polyfill for older browsers. Default is `ES module shim`_. You can pass -any URL to be included, or ``false`` to disable the polyfill. +Configure the polyfill for older browsers. By default, the `ES module shim`_ is loaded +via a CDN. You can pass the key of an item in ``importmap.php`` or ``false`` to disable +the polyfill loading. .. code-block:: yaml framework: asset_mapper: importmap_polyfill: false # disable the shim ... - # importmap_polyfill: 'https://...' # ... or pass some custom URL + # importmap_polyfill: 'my_import_map' # ... or pass an importmap name + +.. tip:: + + You can tell the AssetMapper to load the `ES module shim`_ locally by + using the following command, without changing your configuration: + + .. code-block:: terminal + + $ php bin/console importmap:require es-module-shims + +.. versionadded:: 6.4 + + Passing an importmap name in ``importmap_polyfill`` was + introduced in Symfony 6.4. Prior to this, you could pass ``false`` + or a custom URL to load the polyfill. ``framework.asset_mapper.importmap_script_attributes`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~