patternfly / patternfly/patternfly-react
Bug - Package Publishing - Published Libraries should follow NPM dual module package standards
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 862
- Forks
- 392
- Merge medio
- 4 d 8 h
- PR fusionados (30 d)
- 9
Descripción
PatternFly libraries should follow NPM standards for publishing dual module (CommonJS/ESModule) packages.
PatternFly packages have
"main": "dist/js/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
This is a really early format when es modules were being initially developed and not supported by modern tooling.
NPM documentation links to this as the right way to handle dual module packages.
{
"type": "module",
"exports": {
"import": "./index.mjs",
"require": "./index.cjs"
}
}
Modern tooling like vite builds libraries with a combination of both for compatibility.
{
"name": "my-lib",
"type": "module",
"main": "./dist/my-lib.umd.cjs",
"types": "./dist/my-lib.d.ts",
"module": "./dist/my-lib.js",
"exports": {
".": {
"import": "./dist/my-lib.js",
"require": "./dist/my-lib.umd.cjs"
}
}
}
This is currently blocking us from using vitest to test because it gets really confused. It tries to import the code as ESM but then is unhappy that the package is not marked as type "module". If we manually add type 'module', it then runs into some code that uses a 'require', which is not valid in the scope of a module.
PatternFly packages should support both ESM and CommonJS using NPM standards for better compatibility.
This affects all PF packages not just react-core.
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
Revisa los campos de metadatos de paquete mostrados en el issue en todos los paquetes de PatternFly y luego reproduce el problema actual de resolución de módulos con vitest. Consulta primero las referencias de NPM package-examples y Vite library-mode; se considera terminado cuando cada paquete afectado admite tanto ESM como CommonJS mediante metadatos de paquete estándar.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- nodejs, typescript
- Área
- build-system, developer-experience, release
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100