"@supermap/iclient-ol": "^11.1.0-beta"
简单创建的react+vite+ts项目,集成@supermap/iclient-ol之后运行报错:
index.js:11 Uncaught TypeError: Cannot read properties of undefined (reading 'from')
at node_modules/safe-buffer/index.js (index.js:11:12)
at __require2 (chunk-TFWDKVI3.js?v=cf50ce66:18:50)
at node_modules/readable-stream/lib/_stream_readable.js (_stream_readable.js:55:14)
at __require2 (chunk-TFWDKVI3.js?v=cf50ce66:18:50)
at node_modules/readable-stream/readable-browser.js (readable-browser.js:1:28)
at __require2 (chunk-TFWDKVI3.js?v=cf50ce66:18:50)
at node_modules/from2/index.js (index.js:1:16)
at __require2 (chunk-TFWDKVI3.js?v=cf50ce66:18:50)
at node_modules/into-stream/index.js (index.js:2:14)
at __require2 (chunk-TFWDKVI3.js?v=cf50ce66:18:50)
测试代码:
const url = "https://iserver.supermap.io/iserver/services/map-world/rest/maps/World";
const map = new Map({
target: 'map',
controls: control.defaults({attributionOptions: {collapsed: false}}).extend([new Logo()]),
view: new View({
center: [0, 0],
zoom: 2,
projection: 'EPSG:4326'
})
});
const layer = new TileLayer({
source: new TileSuperMapRest({
url: url,
wrapX: true
}),
projection: 'EPSG:4326'
});
map.addLayer(layer);