8000 [AssetMapper] Put importmap in polyfill so it can be hosted locally easily by alexandre-daubois · Pull Request #19057 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

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

Conversation

alexandre-daubois
Copy link
Member

Fix #19032

Friendly ping @weaverryan, my knowledge on the AssetMapper is super limited 😄

Copy link
Member
@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this :).

Configuring this will be rare. However, there IS something that will be much more common, and I'm not sure where to mention it. By default, we output a CDN URL to the polyfill. If a user wants to avoid the CDN ad serve the polyfill locally, the only need to run:

php bin/console importmap:require es-module-shims

No config changes are needed. AssetMapper sees that this is installed locally, and so uses it instead of the CDN. If you have an idea on where we might put that, I'd appreciate it. Even though it doesn't involve actually changing the importmap_polyfill config, an easy option would be to mention it right in this section.

@@ -1032,14 +1032,20 @@ you expect are being included in the asset map.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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.
an importmap name to load the polyfill, or ``false`` to disable the polyfill loading.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
an importmap name to load the polyfill, or ``false`` to disable the polyfill loading.
the key of an item in ``importmap.php`` or ``false`` to disable the polyfill loading.

@@ -1032,14 +1032,20 @@ you expect are being included in the asset map.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Configure the polyfill for older browsers. Default is `ES module shim`_. You can pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Configure the polyfill for older browsers. Default is `ES module shim`_. You can pass
Configure the polyfill for older browsers. By default, the `ES module shim`_ is loaded via a CDN. You can pass

@alexandre-daubois
Copy link
Member Author

Thank you for the explanation! I added a tip section to explain what you explained about the CDN and the command. What do you think? 🙂

Copy link
Member
@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@OskarStark
Copy link
Contributor

Thank you Alexandre.

@OskarStark OskarStark merged commit fb645e8 into symfony:6.4 Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AssetMapper] Put importmap in polyfill so it can be hosted locally eas…
4 participants
0