Support clearing Node.js cache for package.json
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.3k
- Merge medio
- 4 d 2 h
- PR fusionados (30 d)
- 283
Descripción
What is the problem this feature will solve?
When a long-running Node.js process is active and a package.json file is modified (for example, by adding "type": "module"), Node.js does not detect this change. It continues treating the package as CommonJS, which results in an error like Unexpected token 'export' when attempting to use ES modules.
This is crucial for us at bit, where we run a background process called “bit server” that manages the local development workspace. Among its tasks is creating new web components, which initially have a package.json without "type": "module". If the component is later determined to be ESM, the package.json is updated accordingly. (Explaining why this can’t be handled differently is beyond the scope of this feature request).
What is the feature you are proposing to solve the problem?
I propose adding an API that allows clearing the cached information related to the package.json of a specific module (or optionally clearing the cache for all modules). Either option would solve the issue.
What alternatives have you considered?
Restarting the Node.js process, but this results in a poor user experience.
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.
Línea de trabajo
El issue no nombra ningún archivo ni prueba. Empieza rastreando dónde almacena Node.js en caché los metadatos de módulo de package.json y, después, define una API para borrar la caché de un módulo y, opcionalmente, la de todos los módulos; el trabajo estará terminado cuando los cambios en el tipo de paquete se reconozcan sin reiniciar el proceso.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, node.js
- Área
- backend
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100