'Error using import maps - ERR_ABORTED 404 (Not Found)*

I am trying to use import maps to import the web3.storage module.

I have tried:

 <script type="importmap">
      {
        "imports": {
          "web3.storage/": "./node_modules/web3.storage/dist/src/lib"
        }
      }
 </script>

and

<script type="importmap">
     {
       "imports": {
         "web3.storage": "./node_modules/web3.storage/dist/src/lib.js"
       }
     }
   </script>

I am trying to later import the module like this:

 <script type="module">
    import { Web3Storage } from "web3.storage";
 </script>

This is the error I am getting:

GET http://localhost:3005/node_modules/web3.storage/dist/src/lib.js net::ERR_ABORTED 404 (Not Found)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source