在 React 18 上安装包时遇到问题

Having a problem with installing a package on React 18

我尝试安装 react-neshan-map-leaflet,一切都安装得很好,没有错误,

项目启动后,看到这个错误:

ERROR in ./node_modules/react-neshan-map-leaflet/dist/NeshanMap.js 2:0-60
Module not found: Error: Can't resolve './loaders/neshan_map_loader' in 'C:\Users\Desktop\time-line\node_modules\react-neshan-map-leaflet\dist'
Did you mean 'neshan_map_loader.js'?
BREAKING CHANGE: The request './loaders/neshan_map_loader' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

我终于找到了方法,也许它也适用于你: 我用的是react 18,首先我把版本改成17.0.2 之后我使用了较低版本的软件包并且一切正常。