---
title: "Reducing Bundle Size"
description: "Exclude unused networks from your final bundle with the 'networks' module option."
canonical_url: "https://nuxt-social-share.stefanobartoletti.it/usage/reducing-bundle-size"
last_updated: "2026-07-29T12:59:35.787Z"
---

## Why

By default, all supported networks are bundled with your app, even if you only ever render a couple of them. Each network's data (icon, share URL template, color) is small on its own, but most sites only need a handful, so it is usually not necessary to load all 20+ of them.

## Usage

If you know in advance which networks your site needs, you can set the optional `networks` key in the module configuration, to define a whitelist of network names.

Networks not listed here will be excluded from the build entirely, rather than just being unused code in the final bundle:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  socialShare: {
    baseUrl: 'https://www.yoursite.com',
    networks: ['facebook', 'x', 'linkedin', 'email'], // only these get bundled
  },
})
```

See [Supported Networks](/usage/supported-networks) for the full list of valid names, including aliases (e.g. `twitter` for `x`).

<tip>

Once this is set, you can read the same list back in your own components via `useRuntimeConfig().public.socialShare.networks` instead of hardcoding it a second time wherever you render your share buttons.<br />


See [Avoiding duplication with the `networks` option](/examples/multiple-buttons#avoiding-duplication-with-the-networks-option)

</tip>

## What happens with excluded networks

If a `<SocialShare>` component (or a `useSocialShare()` call) references a network that isn't in your `networks` list, it fails gracefully: no share button is rendered, and a warning is logged to the console explaining that the network was excluded by your configuration (as opposed to being genuinely unsupported), so you know to add it to the list rather than assuming you made a typo.

## Nuxt Layers

<tip>

If you use [Nuxt Layers](https://nuxt.com/docs/getting-started/layers), be aware that array options are merged by concatenation, not overridden: a base layer's `networks: ['facebook']` combined with an extending app's `networks: ['linkedin']` results in `networks: ['linkedin', 'facebook']`, not just the app's value.

</tip>
