Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
¿Para qué se utiliza el tipo de script importmap?

¿Qué es <script type="importmap"> y por qué de repente lo necesito para que mi código funcione?

 <script type="importmap"> { "imports": { "three": "https://example.com/3dstuff/three.module.js" } } </script>

Antes, simplemente escribía esto y Three.js funcionaba, pero ahora esta parte no funciona sin el mapa de importación:

 <script type="module"> import * as THREE from "https://example.com/3dstuff/three.module.js";
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El mapa de importación en su código esencialmente está configurando un acceso directo desde la cadena "tres" a la URL del archivo .js real. Lo que debería estar escribiendo en su <script type="module"> es import * as three from "three"; y se resolverá automáticamente en la URL debido al mapa de importación que definiste antes.

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

Suministrando al navegador el siguiente mapa de importación

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

lo anterior actuaría como si hubieras escrito

 import moment from "/node_modules/moment/src/moment.js"; import { partition } from "/node_modules/lodash-es/lodash.js";
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!