Last active
March 2, 2023 16:46
-
-
Save acip/52bc1b588f31393333ddd77df779bd33 to your computer and use it in GitHub Desktop.
JavaScript Import Maps - use Laravel mix for modules versioning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="importmap"> | |
{ | |
"scopes": { | |
"/path/to/modules": { | |
"m1": "{{ mix("/js/m1.js") }}", | |
"m2": "{{ mix("/js/m2.js") }}" | |
} | |
} | |
} | |
</script> | |
{{-- | |
Notes: | |
1. The structure should be a valid JSON (e.g. no trailing commas) | |
2. Relative paths for module name are not considered, so ./m1.js instead of m1 doesn't work. | |
--}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At this moment, Safari doesn't support import maps for JavaScript. Use Import Maps polyfill.