Skip to content

cloudpack bundle

cloudpack bundle bundles one or more packages without starting a dev server. This is useful for creating production builds or debugging bundling issues in isolation.

By default, it will bundle the package in the current directory (skipping dependency resolution as a performance optimization). With --match, it will bundle the specified package(s).

Options

Common options also apply. Run yarn cloudpack bundle --help to see all the current options.

(You can configure package-specific behavior in cloudpack.config.json.)

OptionValue typeDescription
--matchstring...Bundle specific package(s), optionally with a version: e.g. --match foo --match '@foo/*' --match foo@1.2.3
--mode'library' | 'production'Package bundling mode (default: 'library').
--bundler'ori' | 'rollup' | 'rspack' | 'webpack'Force using a specific bundler.
--outdirstringPath for the bundle output, relative to current path (or the resolved path to --match if specified). Default is a path under the cloudpack cache.
--disable-source-mapsn/aDisable source maps.
--log-bundle-infon/aWrite log files in each package's output folder with bundle input, output, and info.

Examples

The examples below cover some common scenarios. Most of the options should work in combination with other ones even if not covered by examples.

bash
# Bundle the package in the current folder (output in cloudpack cache)
cloudpack bundle

# Make a production bundle of the current package (all dependencies included)
# output to dist/browser-esm
cloudpack bundle --mode prod --outdir dist/browser-esm

# Bundle all packages called "foo" and "bar" (exact string match, any version,
# output in cloudpack cache)
cloudpack bundle --match foo bar

# Bundle foo@1.2.3 with rspack (output in cloudpack cache)
cloudpack bundle --match foo@1.2.3 --bundler rspack

# Bundle all packages starting with @scope/
# (quotes required to prevent shell expansion; output in cloudpack cache)
cloudpack bundle --match '@scope/*'