@@ -188,11 +188,6 @@ to add any `npm package`_:
188
188
189
189
$ php bin/console importmap:require bootstrap
190
190
191
- .. note ::
192
-
193
- If you're getting a 404 error, you can contact the package maintainer and ask them to
194
- include `"main": ` and `"module": ` to the package's `package.json `.
195
-
196
191
This adds the ``bootstrap `` package to your ``importmap.php `` file::
197
192
198
193
// importmap.php
@@ -212,8 +207,14 @@ This adds the ``bootstrap`` package to your ``importmap.php`` file::
212
207
such as ``@popperjs/core ``. The ``importmap:require `` command will add both the
213
208
main package *and * its dependencies. If a package includes a main CSS file,
214
209
that will also be added (see :ref: `Handling 3rd-Party CSS <asset-mapper-3rd-party-css >`).
215
- If the associated CSS file isn't added to the importmap, you can contact the package
216
- maintainer and ask them to include `"style": ` to the package's `package.json `.
210
+
211
+ .. note ::
212
+
213
+ If you get a 404 error, there might be some issue with the JavaScript package
214
+ that prevents it from being served by the ``jsDelivr `` CDN. For example, the
215
+ package might be missing properties like ``main `` or ``module `` in its
216
+ `package.json configuration file `_. Try to contact the package maintainer to
217
+ ask them to fix those issues.
217
218
218
219
Now you can import the ``bootstrap `` package like usual:
219
220
@@ -449,7 +450,10 @@ To include it on the page, import it from a JavaScript file:
449
450
450
451
Some packages - like ``bootstrap `` - advertise that they contain a CSS
451
452
file. In those cases, when you ``importmap:require bootstrap ``, the
452
- CSS file is also added to ``importmap.php `` for convenience.
453
+ CSS file is also added to ``importmap.php `` for convenience. If some package
454
+ doesn't advertise its CSS file in the ``style `` property of the
455
+ `package.json configuration file `_ try to contact the package maintainer to
456
+ ask them to add that.
453
457
454
458
Paths Inside of CSS Files
455
459
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1138,3 +1142,4 @@ command as part of your CI to be warned anytime a new vulnerability is found.
1138
1142
.. _sensiolabs/typescript-bundle : https://github.com/sensiolabs/AssetMapperTypeScriptBundle
1139
1143
.. _`dist/css/bootstrap.min.css file` : https://www.jsdelivr.com/package/npm/bootstrap?tab=files&path=dist%2Fcss#tabRouteFiles
1140
1144
.. _`dynamic import` : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import
1145
+ .. _`package.json configuration file` : https://docs.npmjs.com/creating-a-package-json-file
0 commit comments