Giter Club home page Giter Club logo

Comments (12)

alex3165 avatar alex3165 commented on August 22, 2024 2

@DominikLevitsky Currently on it @philpl is helping on this 👍

from react-mapbox-gl.

alex3165 avatar alex3165 commented on August 22, 2024

https://github.com/mapbox/mapbox-gl-js#using-mapbox-gl-js-with-webpack

from react-mapbox-gl.

paandahl avatar paandahl commented on August 22, 2024

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.

alex3165 avatar alex3165 commented on August 22, 2024

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.

alex3165 avatar alex3165 commented on August 22, 2024

https://github.com/alex3165/react-mapbox-gl/pull/25/files

from react-mapbox-gl.

paandahl avatar paandahl commented on August 22, 2024

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.

DominikLevitsky avatar DominikLevitsky commented on August 22, 2024

Hey, any updates on this? Would be really cool to have this fixed.

from react-mapbox-gl.

buildbreakdo avatar buildbreakdo commented on August 22, 2024

@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.

DominikLevitsky avatar DominikLevitsky commented on August 22, 2024

@alex3165 Hi. Any chances for us to get an update in the next couple of days? :)

from react-mapbox-gl.

alex3165 avatar alex3165 commented on August 22, 2024

@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.

alex3165 avatar alex3165 commented on August 22, 2024

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.

kitten avatar kitten commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.