The `package.json` is missing the `main` or `exports` fields
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
- Área
- build-system
Línea de trabajo
Comienza inspeccionando package.json, la carpeta dist existente y el punto de entrada index.js referenciado. Comprueba el contenido del paquete que se publicaría y cómo se consume la salida actual de la compilación; se considera terminado únicamente cuando solo se distribuyen los archivos dist previstos y las importaciones del paquete se resuelven en el punto de entrada transpilado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Issue
The package.json doesn't filter what files should be packaged and sent the NPM. Therefore, all the source code with .less files is being distributed.
Also, the entry point of the package is not specified using main, module, or exports. That way, it's confusing for the bundlers what should be used and usually they start picking the files from the src:
https://github.com/NUKnightLab/TimelineJS3/blob/c5948d41fd333a1d292ec1c497c38e52ef793013/index.js#L1
So it requires to double-transpile the package in the consuming app and they don't benefit from the transpilation done before publishing anyway 😢
Suggested changes
- Limit the distributed code only to the
distfolder. That will significantly reduce the size of the package. - Specify an entry point explicitly and it should point to the transpiled files in the
dist.
Smth like this[^1]:
{
"name": "@knight-lab/timelinejs",
"version": "4.0.0",
"type": "module",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/index.js"
}
},
"main": "./dist/index.js",
...
Config breakdown
Node has already come up with the following package.json properties that allow to limit what will get published to NPM:
- files - "an array of file patterns that describes the entries to be included when your package is installed as a dependency"
- main - "a module ID that is the primary entry point to your program. That is, if your package is named
foo, a user installs it, and then doesrequire("foo")" - types - Set the types property to point to your bundled declaration file.
- exports - "defining the entry points of a package. An alternative to the "main" that can support defining "subpath exports" and "conditional exports".
- Lenguaje dominante
- JavaScript
- Estrellas
- 3.2k
- Forks
- 645
- Merge medio
- 3 min
- PR fusionados (30 d)
- 2
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.
Más de NUKnightLab/TimelineJS3
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
NUKnightLab/TimelineJS3#797 ·
-
multiple header comments Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
NUKnightLab/TimelineJS3#617 ·
-
Bug CSS
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
NUKnightLab/TimelineJS3#602 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
NUKnightLab/TimelineJS3#904 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
NUKnightLab/TimelineJS3#902 · 2 comentarios ·
Todos los issues de NUKnightLab/TimelineJS3
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
TheOdinProject/curriculum#31423 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
WGBH-MLA/dream-aapb#69 ·
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
Mintplex-Labs/anything-llm#6490 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
openlayers/ol-cesium#1364 ·