microsoft / microsoft/TypeScript
Support import maps and bare import specifiers
@weswigham ya está trabajando en esto.
Desde el 22/3/2021.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
Suggestion
🔍 Search Terms
- import maps
- bare import specifiers
✅ Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
As import maps are part of Chrome (as of version 89), and Firefox has given a nod of approval, it would be great if Typescript embraced this cross-package import syntax.
Import maps assume an index.html (for example) file with a script tag, e.g.:
<script type="importmap">
{
"imports": {
"moment": "/node_modules/moment/src/moment.js",
"lodash": "/node_modules/lodash-es/lodash.js"
}
}
</script>
I would suggest being able to
- Point to a file containing such an importmap in tsconfig and/or
- Just supporting bare import specifiers, based on package.json/package-lock.json, the way unpkg.com is able to do..
📃 Motivating Example
Now you can reference cross-package JS files seamlessly, without bundling tools, based on browser standards.
Workaround:
The path resolution Typescript provides is inadequate, and quite unhelpful.
The only fairly reliable workaround I've found is cloning the repo to a sibling folder of my project.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Evaluación
Este issue todavía no se ha evaluado.