From e03b829b27fbc869d4f576c99db4651686c816c0 Mon Sep 17 00:00:00 2001 From: Azra Lalji Date: Fri, 29 Jul 2022 17:42:15 +0000 Subject: [PATCH 1/2] fix map not loading in prod --- react-app/package-lock.json | 31 ++++++++++++++++++- react-app/package.json | 3 +- .../detailed-results/detailed-results.jsx | 6 ++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/react-app/package-lock.json b/react-app/package-lock.json index 72fd629..5bc2341 100644 --- a/react-app/package-lock.json +++ b/react-app/package-lock.json @@ -27,7 +27,8 @@ "react-router-dom": "^6.3.0", "react-scripts": "5.0.1", "styled-components": "^5.3.5", - "web-vitals": "^2.1.4" + "web-vitals": "^2.1.4", + "worker-loader": "^3.0.8" } }, "node_modules/@ampproject/remapping": { @@ -17507,6 +17508,25 @@ "workbox-core": "6.5.3" } }, + "node_modules/worker-loader": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-3.0.8.tgz", + "integrity": "sha512-XQyQkIFeRVC7f7uRhFdNMe/iJOdO6zxAaR3EWbDp45v3mDhrTi+++oswKNxShUNjPC/1xUp5DB29YKLhFo129g==", + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -30102,6 +30122,15 @@ "workbox-core": "6.5.3" } }, + "worker-loader": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-3.0.8.tgz", + "integrity": "sha512-XQyQkIFeRVC7f7uRhFdNMe/iJOdO6zxAaR3EWbDp45v3mDhrTi+++oswKNxShUNjPC/1xUp5DB29YKLhFo129g==", + "requires": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + } + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/react-app/package.json b/react-app/package.json index 12b68aa..d4d2225 100644 --- a/react-app/package.json +++ b/react-app/package.json @@ -22,7 +22,8 @@ "react-router-dom": "^6.3.0", "react-scripts": "5.0.1", "styled-components": "^5.3.5", - "web-vitals": "^2.1.4" + "web-vitals": "^2.1.4", + "worker-loader": "^3.0.8" }, "scripts": { "start": "react-scripts start", diff --git a/react-app/src/routes/detailed-results/detailed-results.jsx b/react-app/src/routes/detailed-results/detailed-results.jsx index d8e3af1..f0bfc3a 100644 --- a/react-app/src/routes/detailed-results/detailed-results.jsx +++ b/react-app/src/routes/detailed-results/detailed-results.jsx @@ -7,9 +7,15 @@ import { BsCalendarFill } from "react-icons/bs"; import { MdLocationPin } from "react-icons/md"; import { GoLinkExternal } from "react-icons/go"; import Map, { Marker } from "react-map-gl"; +import mapboxgl from "mapbox-gl"; import "mapbox-gl/dist/mapbox-gl.css"; + import { apiBaseUrl, appBaseUrl } from "../../utilities/base-url"; +// eslint-disable-next-line import/no-webpack-loader-syntax +mapboxgl.workerClass = require("worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker").default; + + export default function DetailedResults() { const location = useLocation(); const festival = location.state; From 53a84f04f3aa5e18d2ab78c694fcb02f87aadb52 Mon Sep 17 00:00:00 2001 From: Stanford Lin Date: Fri, 29 Jul 2022 18:07:18 +0000 Subject: [PATCH 2/2] Added URL to temp fix --- react-app/src/routes/detailed-results/detailed-results.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/react-app/src/routes/detailed-results/detailed-results.jsx b/react-app/src/routes/detailed-results/detailed-results.jsx index f0bfc3a..5c6dea4 100644 --- a/react-app/src/routes/detailed-results/detailed-results.jsx +++ b/react-app/src/routes/detailed-results/detailed-results.jsx @@ -12,6 +12,7 @@ import "mapbox-gl/dist/mapbox-gl.css"; import { apiBaseUrl, appBaseUrl } from "../../utilities/base-url"; +// Temp bug fix: https://github.com/visgl/react-map-gl/issues/1266#issuecomment-753686953 // eslint-disable-next-line import/no-webpack-loader-syntax mapboxgl.workerClass = require("worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker").default;