The importmap in your code is essentially setting up a shortcut from the string "three" to the actual .js file URL. What you should be writing in your <script type="module"> is import * as three from "three"; and it will automatically resolve to the URL due to the importmap you defined before.

From https://github.com/WICG/import-maps:

By supplying the browser with the following import map

<script type="importmap">
{
  "imports": {
    "moment": "/node_modules/moment/src/moment.js",
    "lodash": "/node_modules/lodash-es/lodash.js"
  }
}
</script>

the above would act as if you had written

import moment from "/node_modules/moment/src/moment.js";
import { partition } from "/node_modules/lodash-es/lodash.js";
Answer from ps4star on Stack Overflow
🌐
Honeybadger
honeybadger.io › blog › import-maps
Everything You Need to Know About JavaScript Import Maps - Honeybadger Developer Blog
July 25, 2022 - Import maps makes it possible to use bare module specifiers in the browser without depending on the complicated build systems currently prevalent in the JavaScript ecosystem, but it is not widely supported in web browsers at the moment.
🌐
web.dev
web.dev › blog › javascript import maps are now supported cross-browser
JavaScript import maps are now supported cross-browser  |  Blog  |  web.dev
March 28, 2023 - To use the <script type="importmap"> approach, you first need to add it to the <head> section of your HTML document. Inside the tag, you can define a JSON object that maps module names to their corresponding URLs.
🌐
Medium
medium.com › @saranya.shanmugavel › import-maps-advanced-module-loading-made-simple-dacc6174405f
Import Maps: Advanced Module Loading Made Simple | by Saranya | Medium
June 16, 2025 - ES2020 introduced dynamic import() natively. Combined with import maps, you can now achieve scoped, on-demand module loading directly in the browser—without a bundler.
🌐
12daysofweb
12daysofweb.dev › 2024 › js-import-maps
JS Import Maps | 12 Days of Web
December 20, 2024 - Import Maps tell browsers exactly where to find these modules, mapping bare import names to their actual locations.
🌐
Spidermonkey
spidermonkey.dev › blog › 2023 › 02 › 23 › javascript-import-maps-part-1-introduction.html
JavaScript Import maps, Part 1: Introduction | SpiderMonkey JavaScript/WebAssembly Engine
February 23, 2023 - Import maps are designed to reduce the friction of resolving module specifiers between different Javascript runtimes like Node.js and browsers. It not only saves us from using bundlers like webpack or Babel but also gives us the ergonomics of bare specifiers while ensuring that the security properties of URLs are preserved.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › script › type › importmap
<script type="importmap"> HTML attribute value - HTML | MDN
4 weeks ago - An import map is a JSON object that allows developers to control how the browser resolves module specifiers when importing JavaScript modules. It provides a mapping between the text used as the module specifier in an import statement or import() operator, and the corresponding value that will ...
🌐
iO tech_hub
techhub.iodigital.com › articles › js-import-maps
Import maps in JavaScript
May 3, 2023 - Introduced in the ECMAScript proposal stage in 2019 and added to the ECMAScript standard in 2021, import maps offer a new way to manage JavaScript modules without the need for a build process.
🌐
GitHub
github.com › rails › importmap-rails
GitHub - rails/importmap-rails: Use ESM with importmap to manage modern JavaScript in Rails without transpiling or bundling. · GitHub
Import maps let you import JavaScript modules using logical names that map to versioned/digested files – directly from the browser. So you can build modern JavaScript applications using JavaScript libraries made for ES modules (ESM) without ...
Find elsewhere
🌐
Can I Use
caniuse.com › import-maps
Import maps | Can I use... Support tables for HTML5, CSS3, etc
Import maps allow control over what URLs get fetched by JavaScript import statements and import() expressions.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-dynamically-import-javascript-with-import-maps
How to Dynamically Import JavaScript with Import Maps | DigitalOcean
October 14, 2021 - Build tools are an important part of the development experience, but a spec called import maps will allow you to both import external code into your project …
🌐
Michael Currin
michaelcurrin.github.io › dev-cheatsheets › cheatsheets › javascript › general › modules › import-maps.html
Import maps | Dev Cheatsheets
Import maps allows control over what URLs get fetched by JavaScript import statements and import() expressions.
🌐
DhiWise
dhiwise.com › post › javascript-import-maps-for-module-management
JavaScript Import Maps: Manage JavaScript Modules Like a Pro
September 5, 2024 - The syntax follows a simple structure: module name as the key, and the corresponding source URL (in this case, using the Skypack CDN) as the value. Now, in your JavaScript code, you can import these modules using their defined aliases:
🌐
Spidermonkey
spidermonkey.dev › blog › 2023 › 03 › 02 › javascript-import-maps-part-2-in-depth-exploration.html
JavaScript Import maps, Part 2: In-Depth Exploration | SpiderMonkey JavaScript/WebAssembly Engine
March 2, 2023 - Let’s explain the terms first. The string literal "app.mjs" in the above examples is called a Module Specifier in ECMAScript, and the map which maps "app.mjs" to a URL is called a Module Specifier Map. An import map is an object with two optional items:
🌐
Web.dev
web.dev › shows › this-is-baseline › Bx29-8SD1OM
Manage your JavaScript with Import Map  |  web.dev
October 24, 2024 - A modern way to use JavaScript modules is with the script type="importmap" tag. This lets you to define a mapping of external module names to their corresponding URLs, making it easier to include and use external modules in your code.
🌐
InfoQ
infoq.com › news › 2023 › 04 › import-maps-generally-available
Import Maps, Now Available in All Browsers, Improves Module Resolution in JavaScript - InfoQ
April 9, 2023 - An import map allows resolving module specifiers in ad-hoc ways. With import maps, developers can separate the referencing of module dependencies from their location (on disk or a remote server).
🌐
Medium
medium.com › jungletronics › mastering-import-maps-in-rails-8-5f6c32991aa8
Mastering Import Maps in Rails 8. A Step-by-Step Guide to Efficient… | by J3 | Jungletronics | Medium
January 12, 2025 - In production, everything is cleaner because Rails efficiently manages your JavaScript. Once you import scripts by their logical names (#7), as mapped in a special configuration file (#6), Rails takes care of the rest. With just one line to activate it all: <%= javascript_importmap_tags %>(#4).
🌐
Google
developers.google.com › google maps platform › maps javascript api › load the maps javascript api
Load the Maps JavaScript API  |  Google for Developers
3 weeks ago - The Google Maps JavaScript API can be loaded using dynamic library import, a direct script loading tag, or the NPM js-api-loader package.
🌐
Reddit
reddit.com › r/javascript › everything you need to know about javascript import maps
r/javascript on Reddit: Everything You Need To Know About JavaScript Import Maps
July 25, 2022 - Import maps are a new way for web pages to control the behavior of JavaScript imports, potentially enabling you to ditch your build system. In this…
🌐
Modern Web
modern-web.dev › docs › dev-server › plugins › import-maps
Plugins: Import Maps: Modern Web
Import Maps can be used to resolve imports in your code as an alternative to the --node-resolve flag, or to mock modules. ... This proposal allows control over what URLs get fetched by JavaScript import statements and import() expressions.