Comments (12)
@DominikLevitsky Currently on it @philpl is helping on this 👍
from react-mapbox-gl.
https://github.com/mapbox/mapbox-gl-js#using-mapbox-gl-js-with-webpack
from react-mapbox-gl.
The precompiled file caused issues for me running a universal app (was complaining window not being available on server side).
I simply cloned the repo and switched the imports to "mapbox-gl", and now it works just fine. (I already had the necessary webpack config in place).
from react-mapbox-gl.
Hi @PrebenL, thanks for reporting this issue, i haven't really spend lot of time on this as it was just a warning but i didn't know that the pre-compiled version is failing when doing a server side rendering of the component.
I will have a look as soon as possible.
from react-mapbox-gl.
https://github.com/alex3165/react-mapbox-gl/pull/25/files
from react-mapbox-gl.
As to the exact why, I don't know either, but I think somewhere in the "mapbox-gl" library there is some kind of dynamic switching, allowing the "gl" library (also known as headless gl), to take over when you're on an environment where window / web-gl is not available (i.e. server).
from react-mapbox-gl.
Hey, any updates on this? Would be really cool to have this fixed.
from react-mapbox-gl.
@alex3165 react-mapbox-gl references https://github.com/mapbox/mapbox-gl-js/blob/master/js/util/browser/browser.js when I believe it should reference the headless version https://github.com/mapbox/mapbox-gl-js/blob/master/js/util/browser.js?
from react-mapbox-gl.
@alex3165 Hi. Any chances for us to get an update in the next couple of days? :)
from react-mapbox-gl.
@DominikLevitsky I will give you an update by the end of the week-end and hopefully come up with a solution :)
from react-mapbox-gl.
So now mapbox-gl-js is compiled using Webpack see #43. I think it will still not be possible to render on the server side though because the library is using web worker for some operation and this won't work in a nodejs environment.
from react-mapbox-gl.
It's very hard to determine how to "make the switch" to the mocked browser of mapbox-gl. I think technically it's not hard to switch it around, but it's hard to determine, whether React is being rendered in a server-side context. If someone has input on that, I'd appreciate it.
Edit: Actually since we're precompiling mapbox-gl as a vendor bundle, there might still be code present, that is responsible for the switch. @PrebenL, you might have more information and are able to test whether it works? The version with the change is 0.10
from react-mapbox-gl.
Related Issues (20)
- Invalid LngLat object error when zooming on markers
- Example needed: OpenStreetmap Example without Mapbox accessToken
- DrawControl in React v18 and above
- ultra-weird bug : some images don't show up on mobile devices (works fine on desktop computer) HOT 2
- React v18: Map container is being appended to DOM twice
- Renders black screen after multiple renders. HOT 1
- Popup missing `closeOnClick` prop
- Control Feature fade in animation
- Markers wiggle on React 18 HOT 6
- Cluster Marker disappearing when zoom screen with 70%, 80%
- Cannot assign to import "accessToken" error on Remix HOT 5
- [HELP] MapboxMap - how to use onLoad to switch displayed language of map?
- Layers do not renderer HOT 2
- ReactMapGL not showing after deploying, buit during development it is working perfectly HOT 1
- Is GL JS v3 supported ? HOT 1
- add open-ended option overrides in constructor
- Features not showing
- WebpackError: TypeError: _layer_events_hoc__WEBPACK_IMPORTED_MODULE_1___defaul t(...) is not a function HOT 1
- Feature coordinates not adjusting to new variables. HOT 1
- Peer dependencies HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-mapbox-gl.