Overview of Bundle Caching in React on Rails Pro
Bundle caching avoids redundant webpack builds by caching bundles based on a digest of source files. This is particularly useful in CI/CD pipelines (Review apps, Staging, Production) or when deploying Ruby-only changes that don't require a full JS rebuild. The cache key is generated from:
- Source files defined in
config/shakapacker.yml. - Files defined in
config.dependency_globs(excludingconfig.excluded_dependency_globs). - The
NODE_ENVvalue. - The version of React on Rails Pro.
- Custom environment values defined in the
remote_bundle_cache_adapter.cache_keysmethod.