react-mapbox-gl
react-mapbox-gl copied to clipboard
Consider support for MapLibreGL
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?
I'd be interested in this as well.
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' },
]
})
]
};
Is there any update about this request? I'd be glad to help too.
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 , have yu added the alias in tsconfig.json?