无法从deck.gl/mapbox检测MapboxLayer

问题描述 投票:0回答:1

以下这个

我的 package.json 中有以下内容:

{
  "name": "cesium-deckgl-viewer-vite",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "vite preview"
  },
  "devDependencies": {
    "typescript": "~5.6.2",
    "vite": "^6.0.1"
  },
  "dependencies": {
    "@deck.gl/core": "^9.0.38",
    "@deck.gl/geo-layers": "^9.0.38",
    "@deck.gl/mapbox": "^9.0.38",
    "@loaders.gl/3d-tiles": "^4.3.3",
    "@loaders.gl/core": "^4.3.3",
    "@probe.gl/log": "^4.0.9",
    "mapbox-gl": "^3.8.0"
  }
}

在我的index.js中:

import {MapboxLayer} from '@deck.gl/mapbox';

但是它给了我错误:

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/@deck__gl_mapbox.js?v=5cb1e8a3' does not provide an export named 'MapboxLayer'

我的设置中缺少什么?

javascript vite mapbox deck.gl
1个回答
0
投票

看起来您正在使用

@deck.gl/mapbox v9
。 检查文档here,它说:
MapboxLayer has been removed. Use MapboxOverlay instead.

© www.soinside.com 2019 - 2024. All rights reserved.