8000 [Frontend] AssetMapper: Allow disabling the ES Module Shim · Issue #50912 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Frontend] AssetMapper: Allow disabling the ES Module Shim #50912

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

Closed
ThomasLandauer opened this issue Jul 7, 2023 · 3 comments
Closed

[Frontend] AssetMapper: Allow disabling the ES Module Shim #50912

ThomasLandauer opened this issue Jul 7, 2023 · 3 comments

Comments

@ThomasLandauer
Copy link
Contributor

Description

Right now, {{ importmap() }} is adding this automatically:

<!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support -->
<script async src="https://ga.jspm.io/npm:es-module-shims@1.7.2/dist/es-module-shims.js"></script>

I think there should be a way to disable loading this file.

Example

ImportMapRenderer has a constructor argument to disable this; I just couldn't find a way to set this from importmap().

In the end, it could look something like:

{{ importmap({shim: true}) }}

I even suggest to exclude it by default for two reasons:

  • Loading any external resources needs to be a conscious decision of the developer (security, privacy, etc.). In Germany, there's some fuss about webmasters getting sued for including Google Fonts like this!
  • Over time, the shim will become less important
@stof
Copy link
Member
stof commented Jul 7, 2023

The asset_mapper configuration of FrameworkBundle has a setting to configure that constructor argument:

You cannot configure this from the call to importmap because this call has no way to alter the constructor arguments (it can only call the method)

ThomasLandauer added a commit to ThomasLandauer/symfony-docs that referenced this issue Jul 7, 2023
Please doublecheck - the info is taken from symfony/symfony#50912 (comment)
@ThomasLandauer
Copy link
Contributor Author

Thanks, please take a look at symfony/symfony-docs#18537 if I got the syntax right...

@weaverryan
Copy link
Member

Closing this in favor of the docs PR - thanks Thomas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0