---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../../modules.md) / [operations/mrt](../index.md) / createBundle

# Function: createBundle()

> **createBundle**(`options`): `Promise`\<[`Bundle`](../interfaces/Bundle.md)\>

Defined in: [packages/b2c-tooling-sdk/src/operations/mrt/bundle.ts:173](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/operations/mrt/bundle.ts#L173)

Creates a bundle from a build directory.

This creates a tar archive of the build directory, base64 encodes it,
and returns a bundle object ready for upload to Managed Runtime.

The archive structure is: `{projectSlug}/bld/{files...}`

## Parameters

### options

[`CreateBundleOptions`](../interfaces/CreateBundleOptions.md)

Bundle creation options

## Returns

`Promise`\<[`Bundle`](../interfaces/Bundle.md)\>

Bundle object ready for upload

## Throws

Error if build directory doesn't exist or ssr patterns are empty

## Example

```typescript
const bundle = await createBundle({
  projectSlug: 'my-project',
  ssrOnly: ['ssr.js'],
  ssrShared: ['**/*.js', 'static/**/*'],
  buildDirectory: './build',
  message: 'Release v1.0.0'
});
```
