danilowoz / danilowoz/react-content-loader
Add the "type": "module" to the package.json file
- Dominant language
- TypeScript
- Stars
- 14k
- Forks
- 421
- PR merge metrics
- No merged PRs in 30d
Description
## What did you do?
The `package.json` file contains esm exports without using the "type": "module" key.
This behavior breaks bundlers like vitest due to the misleading package.json format.
## What did you expect to happen?
The switch from commonjs to esm should grant that the consumers (bundlers, compilers...) will receive a specs compliant package.json file.
## What happened actually?
Error displayed in vitest
```
Module /node_modules/react-content-loader/dist/react-content-loader.es.js:1 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "react-content-loader" asking them to ship
the file in .mjs extension or add "type": "module" in their package.json.
As a temporary workaround you can try to inline the package by updating your config:
// vitest.config.js
export default {
test: {
server: {
deps: {
inline: [
"react-content-loader"
]
}
}
}
}
```
### Which versions of react-content-loader, and which browser are affected by this issue?
`react-content-loader@7.0.2`
Please let me know if you need a demo project to replicate the issue 🙏
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.