小编Abd*_*dul的帖子

控制台中的 Mapbox 生产错误。“未捕获的 ReferenceError:y 未定义”

我在 Heroku 上部署了一个全栈 React.js 应用程序。除了 Mapbox 之外,一切都部署得很好。在开发中,一切正常。一旦我在 Heroku 中打开我的应用程序,Mapbox 就会显示一个黑屏。

我在 Heroku 中为默认公共 Mapbox 令牌添加了配置变量。

当我在生产中检查控制台时,我收到一条错误消息“Uncaught ReferenceError: y is not defined”

我正在将 Mapbox 与 React Map GL 一起使用,但不确定问题是什么,此时正在寻求帮助。

我添加了它在开发中的外观和我在生产中得到的黑屏的屏幕截图。生产-mapbox-错误 开发-mapbox-working

我的客户端 package.json:

  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.8",
    "@testing-library/react": "^11.2.2",
    "@testing-library/user-event": "^12.6.0",
    "framer-motion": "^3.2.1",
    "node-sass": "^4.14.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-hook-form": "^6.14.1",
    "react-map-gl": "^6.0.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "web-vitals": "^0.2.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject" …
Run Code Online (Sandbox Code Playgroud)

javascript heroku reactjs mapbox-gl react-map-gl

5
推荐指数
2
解决办法
1635
查看次数

标签 统计

heroku ×1

javascript ×1

mapbox-gl ×1

react-map-gl ×1

reactjs ×1