Skip to content

Commit

Permalink
Update a guide about explanation related to es-module-shims (#51369)
Browse files Browse the repository at this point in the history
  • Loading branch information
wakairo committed Mar 21, 2024
1 parent 30e3738 commit abbbf19
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions guides/source/asset_pipeline.md
Expand Up @@ -141,18 +141,14 @@ All of the configured import maps should be attached in `<head>` element of your
</script>
```

- [`Es-module-shims`](https://github.com/guybedford/es-module-shims) acting as polyfill ensuring support for `import maps` on older browsers:

```html
<script src="/assets/es-module-shims.min" async="async" data-turbo-track="reload"></script>
```

- Entrypoint for loading JavaScript from `app/javascript/application.js`:

```html
<script type="module">import "application"</script>
```
NOTE: Before v2.0.0, `importmap-rails` put [`Es-module-shims`](https://github.com/guybedford/es-module-shims) in the output of `javascript_importmap_tags` as a polyfill to ensure support for import maps on older browsers. However, with the native support for import maps in all major browsers, v2.0.0 has dropped the bundled shim. If you want to support legacy browsers that lack support for import maps, manually insert `Es-module-shims` before `javascript_importmap_tags`. For more information, refer to [README for importmap-rails](https://github.com/rails/importmap-rails?tab=readme-ov-file#supporting-legacy-browsers-such-as-safari-on-ios-15).
### Using npm packages via JavaScript CDNs
You can use the `bin/importmap` command that's added as part of the `importmap-rails` install to pin, unpin, or update npm packages in your import map. The binstub uses [`JSPM.org`](https://jspm.org/).
Expand Down

0 comments on commit abbbf19

Please sign in to comment.