Skip to content

[AssetMapper] Put importmap in polyfill so it can be hosted locally easily #19057

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

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions frontend/asset_mapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down