Configuration

The NOBEARS Nuxt Mapbox Module works out of the box with zero config*, but you can always add some configurations for finer-grained control.

To configure the Mapbox module and customize its behavior, you can use the mapbox property in your nuxt.config.ts file:

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-mapbox'],
  mapbox: {
    // Options
  },
})

accessToken

The accessToken is required to use the Mapbox API.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-mapbox'],
  mapbox: {
    accessToken: process.env.NUXT_MAPBOX_ACCESS_TOKEN,
  },
})

projection

Default: mercator

The projection used for rendering the map.

As of v0.1.2, only mercator has been tested and is supported, other projections might lead to unexpected results.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-mapbox'],
  mapbox: {
    projection: 'mercator',
  },
})
Learn more about supported projections in the Mapbox projection guide

style

Default: mapbox://styles/mapbox/streets-v12

The style the map should be rendered in.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nobears-front-end/nuxt-mapbox'],
  mapbox: {
    style: 'mapbox://styles/mapbox/streets-v12',
  },
})
Learn more about the Mapbox Style specification in the Mapbox Style Specification