尝试使用 npm 库 react-leaflet-heatmap-layer-v3,在成功安装它然后
yarn start
我的 React TypeScript 应用程序后,我收到以下警告消息:
WARNING in ./node_modules/react-leaflet-heatmap-layer-v3/lib/Heatmap.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/client/node_modules/react-leaflet-heatmap-layer-v3/src/Heatmap.ts' file: Error: ENOENT: no such file or directory, open '/client/node_modules/react-leaflet-heatmap-layer-v3/src/Heatmap.ts'
WARNING in ./node_modules/react-leaflet-heatmap-layer-v3/lib/HeatmapLayer.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/client/node_modules/react-leaflet-heatmap-layer-v3/src/HeatmapLayer.ts' file: Error: ENOENT: no such file or directory, open '/client/node_modules/react-leaflet-heatmap-layer-v3/src/HeatmapLayer.ts'
WARNING in ./node_modules/react-leaflet-heatmap-layer-v3/lib/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/client/node_modules/react-leaflet-heatmap-layer-v3/src/index.ts' file: Error: ENOENT: no such file or directory, open '/client/node_modules/react-leaflet-heatmap-layer-v3/src/index.ts'
当我检查该库的node_modules时,没有“src”目录,但有一个包含所有这些文件的“lib”目录。
我是否遗漏了什么或做错了什么,因为我需要在 package.json 中将这个库与
"react-leaflet": "^4.2.1"
一起使用
我是否需要使用早期版本的react-leaflet才能使其工作?
对于任何可能面临同样问题的人,我最终删除了这个
react-leaflet-heatmap-layer-v3
包并将其替换为 @vgrid/react-leaflet-heatmap-layer
需要进行一些更改,但现在一切都很好。