@salesforce/b2c-tooling-sdk / operations/mrt / createBundleV2
Function: createBundleV2()
createBundleV2(
options):Promise<BundleV2>
Defined in: packages/b2c-tooling-sdk/src/operations/mrt/bundle.ts:649
Creates a v2-format bundle archive from a build directory.
Produces a gzip-compressed tar archive whose entries sit directly under {rootDir}/ (no project-slug prefix, unlike v1), with the SSR configuration written into the archive at {rootDir}/{configPath} (default bld/.mrt/config.json). The returned object carries the archive bytes plus the rootDir/configPath/matchMode values to send as multipart request fields, so the builder and the request stay consistent.
The SSR configuration is resolved as follows: if the build emitted an on-disk v2 config file at {buildDirectory}/{configPath}, it is used; otherwise the project's config.server.{ts,js} is read and used to build the config that goes into the bundle; explicit options override either, merged per key. When the build already emitted the v2 config file, it is excluded from the archive walk and replaced by the resolved config so there is exactly one copy.
Parameters
options
v2 bundle creation options
Returns
Promise<BundleV2>
v2 bundle object ready for multipart upload
Throws
Error if the build directory doesn't exist or ssr patterns are empty
Example
const bundle = await createBundleV2({
ssrOnly: ['ssr.js'],
ssrShared: ['static/**/*'],
buildDirectory: './build',
message: 'Release v1.0.0'
});