diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index 454e13a1d29..8b24723186b 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -301,6 +301,35 @@ You can update your third-party packages to their current versions by running: $ php bin/console importmap:update bootstrap lodash $ php bin/console importmap:outdated bootstrap lodash +Removing Packages from importmap +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you need to remove a JavaScript package that was previously added to your ``importmap.php`` file, you can use the ``importmap:remove`` command. + +.. code-block:: terminal + + $ php bin/console importmap:remove + +For example, to remove the ``lodash`` package from your importmap: + +.. code-block:: terminal + + $ php bin/console importmap:remove lodash + +This will update your ``importmap.php`` file and remove the specified package (and any dependencies added along with it). +After running this command, it is recommended to also run: + +.. code-block:: terminal + + $ php bin/console importmap:install + +This ensures your ``assets/vendor/`` directory is in sync with the updated importmap configuration. + +.. tip:: + + Removing a package from the importmap does not automatically remove any references to it in your JavaScript files. + Make sure to update your code to remove any ``import`` statements that reference the removed package. + How does the importmap Work? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~