BootstrapVue Icons Import Specific Icon Only (Tree Shaking, Reduce Size)

August 24, 2020

Edit nuxt.config.js to import search icons only.

  • You need to import the necessary plugins as well if you utilize them, else they shall not be included.
module.exports = {
  modules: ['bootstrap-vue/nuxt'],
  bootstrapVue: {
    // icons: true // Install the IconsPlugin (in addition to BootStrapVue plugin
    // Add the desired icon components to the `components` array
    components: ['BIconSearch'],
    componentPlugins: ['NavbarPlugin', 'LayoutPlugin', 'ButtonPlugin', 'FormPlugin', 'FormInputPlugin', 'ImagePlugin', 'BadgePlugin', 'LinkPlugin', 'TablePlugin', 'InputGroupPlugin', 'SpinnerPlugin', 'PaginationPlugin', 'PaginationNavPlugin']
  }
}

References:

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.