We have NextJS + TypeScript setup and were looking to integrate Maplibre, which is basically a fork of Mapbox BSD. Also there's this nice wrapper around Mapbox - React Map GL, however it is not designed to work with Maplibre. Workaround is to create an alias in Webpack config, like this:
// webpack.config.js
module.export = {
// ...
resolve: {
alias: {
'mapbox-gl': 'maplibre-gl'
}
}
}
I also have this in the tsconfig.json:
"paths": {
// ...other aliases
"mapbox-gl": ["maplibre-gl"]
},
The problem is that in NextJS + TypeScript setup this for some reason has no effect. Either aliases for modules under node_modules
are ignored by something in NextJS or TypeScript has precedence over some parts of the webpack configuration - it is not immediately clear.
Any ideas?