reactjs

how to load jsx-runtime from esm.sh


Now I am tried to load jsx-runtime from esm.sh like this:

<script type="importmap">
      {
        "imports": { 
          "react/jsx-runtime": "https://esm.sh/react/jsx-runtime@19.1.0"
        }
      }
    </script>

but shows error could not resolve build entry, I have also tried like this. is the esm.sh contains jsx-runtime? I found this lib, but it seems not the expected lib.


Solution

  • When using Esm.sh the version number precedes any path information. So in your example, the correct URL will be:

    https://esm.sh/react@19.1.0/jsx-runtime