OverlayScrollbars: Jest with Node.js v20.11.0 does not understand overlayscrollbars-react
Hi, i noticed about “module” field in package.json is not standard way to define ESM entry point of package.
According this answer: https://github.com/jestjs/jest/issues/9430#issuecomment-1905771034
Can we update package.json of overlayscrollbars packages for to comply with the standard?
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 17 (7 by maintainers)
@krutoo I’ll continue to provide
commonjsandmoduleversions because of backwardscompatibility reasons and because some frameworks / tools simply only support one or another but not always both (or the “right” one).@ChristophP Thank you for the input - really appreciate it!
@nickmccurdy Very useful tool, I’ll definitely use it before I publish the fixed versions - Thanks a bunch!
Regaring the extensions
.mjsis always interpreted as ESM (regardless of the type field of the closes package json up the file tree).cjsis always interpreted as CJS (regardless of the type field of the closes package json up the file tree).jsis interpreted as ESM or CJS depending on thetypefield of the closest package json up the file tree.In that sense if you have
type: moduleset, the ESM file can be called.jsthe CJS file.cjs. If you have no type module set or type: commonjs you can do.mjsfor ESM and.jsfor CJS. If you wanna be absolutely sure regardless you can use.mjs/.cjsfor them respectively.I’ve published:
v2.4.7v0.5.4v0.5.7v0.5.3v0.5.3Which all address this issue and should hopefully fix it properly. I’ve used https://publint.dev and https://arethetypeswrong.github.io/ to identifiy additional issues and fixed them where the error / warning was appropriate.
Please try it out and give feedback 😃
I’d also recommend linting your package with publint.
@KingSora Please also note that the order of the keys matters according to the docs
Conditional exports: https://nodejs.org/api/packages.html#conditional-exports
Good day @krutoo
overlayscrollbars-reactpackage.jsonlooks like this: https://cdn.jsdelivr.net/npm/overlayscrollbars-react@0.5.3/package.jsonIt defines the
exports,mainandmodulefields.