javascript 错误:此平台不支持节点缓冲区

qoefvg9y  于 2023-05-27  发布在  Java
关注(0)|答案(1)|浏览(102)

我尝试使用shpjs包导入形状文件传单Map的基础上shpjs文档:shpjs
下面是我的代码:

const [geoData, setGeoData] = useState(null); //state
      //onChange function
      const onChangeFile = ({ target }) => {
      var reader = new FileReader();
      var file = target.files[0];
      reader.readAsArrayBuffer(file);
      reader.onload = function (buffer) {
        setGeoData(buffer.target.result);
      };
    };

然后我使用shpjs包如下:

const geoJson =  await shp(geoData)

导入www.example.com后shp.zip,我得到此错误:

我该怎么解决这个问题?

rqdpfwrv

rqdpfwrv1#

你可以使用npm包const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');和在react节点模块配置文件和webpackconfig中添加包以上refer this link jay patel作者

相关问题