react-mapbox-gl icon indicating copy to clipboard operation
react-mapbox-gl copied to clipboard

Consider support for MapLibreGL

Open snickell opened this issue 4 years ago • 5 comments

As it sounds like mapbox-gl is no longer open source: https://news.ycombinator.com/item?id=25347310

There's a free software bazaar-style fork of mapbox-gl, maplibre-gl which I was early-on helping with: https://github.com/maplibre/maplibre-gl-js

NPM: https://www.npmjs.com/package/maplibre-gl

Is there a clean way we can support both with these bindings?

snickell avatar Dec 31 '20 09:12 snickell

I'd be interested in this as well.

curran avatar Jan 05 '21 21:01 curran

Related (HT @klokan): https://github.com/visgl/react-map-gl/blob/master/docs/get-started/get-started.md#using-with-a-mapbox-gl-fork

From there:

Using with a mapbox-gl Fork

Install your choice of fork along with react-map-gl, for example:

npm i react-map-gl maplibre-gl

In your bundler's configuration, set the forked library to replace any reference from mapbox-gl. This can be done in Webpack with something like:

// webpack.config.js
module.export = {
  // ...
  resolve: {
    alias: {
      'mapbox-gl': 'maplibre-gl'
    }
  }
}

In rollup:

// rollup.config.js
import alias from '@rollup/plugin-alias';

module.exports = {
  // ...
  plugins: [
    alias({
      entries: [
        { find: 'mapbox-gl', replacement: 'maplibre-gl' },
      ]
    })
  ]
};

curran avatar Jan 06 '21 15:01 curran

Is there any update about this request? I'd be glad to help too.

exaucae avatar Aug 22 '21 04:08 exaucae

A mapping like this:

module.export = {
  // ...
  resolve: {
    alias: {
      'mapbox-gl': 'maplibre-gl'
    }
  }
}

doesn't seem to work in NextJS + TypeScript. Any recommendation for such setup?

jayarjo avatar Sep 17 '21 14:09 jayarjo

@jayarjo , have yu added the alias in tsconfig.json?

exaucae avatar Dec 09 '21 20:12 exaucae