Added
- Added supplemental npm packages
shakapacker-webpackandshakapacker-rspack. PR #1096, PR #1133 by justin808. Optional packages that lockstep with core and declare the managed-build stack as required peer dependencies (so on npm 7+ a singleyarn add shakapacker-webpackauto-installsshakapacker,webpack,webpack-cli, andwebpack-assets-manifest;shakapacker-rspackdeclaresshakapacker,@rspack/core,@rspack/cli, andrspack-manifest-plugin). Required peers eliminate the silent duplicate-bundler failure mode that direct dependencies could cause when an app or transitive dep pins a different bundler version. Optional features (transpilers, dev-server, CSS preprocessors, react-refresh) remain as opt-inpeerDependenciesso SCSS/native-binding bloat isn't forced on every install. The wrappers emit structured warnings (SHAKAPACKER_BUNDLER_MISMATCH,SHAKAPACKER_NO_TRANSPILER) whenconfig.assets_bundlerorjavascript_transpilerdoesn't match the installed peers. pnpm and Yarn PnP users should keep packages imported by app config files as explicit app dependencies (the Rails installer handles this automatically). See the v10.1 migration guide for adoption steps anddocs/dependency-strategy.mdfor the design rationale and v11 roadmap. - Added
shakapacker:doctorcheck for disabled Rspack cache. PR #1100 by justin808. The doctor now inspects the Rspack config file for an explicitcache: false, warns when found (disabling cache causes significantly slower builds), and also flags Rspack v1 installs (where persistent cache is experimental) with a recommendation to upgrade to v2. - Added a
shakapacker:doctorhint to compiler output. PR #1100 by justin808. The compiler now logs a one-time tip suggestingbundle exec rake shakapacker:doctorafter a failed compilation, so healthy build loops stay quiet.
Migration Notes
-
Simplify your
package.jsonby adopting a supplemental package. On npm 7+ (or Yarn 2+ innodeLinker: node-modulesmode), existing apps can drop the explicit managed-build deps fromdevDependenciesand let the supplemental package's required peers be auto-installed:- Rspack apps can replace
shakapacker+@rspack/core+@rspack/cli+rspack-manifest-pluginwith a singleshakapacker-rspack. Seepackages/shakapacker-rspack/README.md§"Simplifying an existing rspack install" for the before/after. - Webpack apps can replace
shakapacker+webpack+webpack-cli+webpack-assets-manifestwith a singleshakapacker-webpack. Seepackages/shakapacker-webpack/README.md§"Simplifying an existing webpack install" for the before/after. - Optional peers (transpilers,
webpack-dev-server, CSS preprocessors, react-refresh) stay only if your app uses those features. - Adoption is opt-in: leaving your
package.jsonuntouched on v10.1 also continues to work.
- Rspack apps can replace
-
Adopting
shakapacker-webpackrequireswebpack-assets-manifest@^6.0.0. Coreshakapackerstill accepts both v5 and v6 (^5.0.6 || ^6.0.0), butshakapacker-webpackpins~6.5.1. Apps still onwebpack-assets-manifest@5.xmust upgrade when switching to the supplemental package; v6 fixed an ENOENT crash on clean builds withmerge: trueand dropped a Node 14 install path. See the v5→v6 release notes andpackages/shakapacker-webpack/README.mdfor details.
⚠️ Breaking Changes
- Breaking: tightened
package.jsonengines.nodeto^20.19.0 || >=22.12.0. PR #1099 by justin808. Raised from>= 20, dropping support for Node 20.0.0–20.18.x and Node 21.x to match@rspack/core@2.0.0-rc.0. Consumers on those versions will hit an engine error with--engine-strictor yarn workspaces and need to upgrade. The PR also bumps.node-versionto22.20.0and updatesconductor-setup.shto enforce the same disjoint range up front, so contributors get a clear error beforeyarn installfails with a confusing engine mismatch.
Changed
- Changed
shakapacker:installto default fresh Rspack installs to v2 (^2.0.0-0). PR #1091 by ihabadham.lib/install/package.jsonnow declares@rspack/coreand@rspack/clias^1.0.0 || ^2.0.0-0; fresh installs pick the v2 range. Existing apps are unaffected. Note: Rspack v2 requires Node.js 20.19.0+. - Slimmed the published gem from ~486K (294 files) to ~121K (75 files). PR #1110, PR #1120 by justin808. Replaced the broad
git ls-filesgem manifest with an explicit runtime/install allowlist (CHANGELOG.md,MIT-LICENSE,README.md, gemspec,lib,sig,package.json), excluding repo-only docs, tests, JavaScript package source, CI/tooling files, andtest_filesmetadata from the published gem. Fixes #987.
Fixed
- Fixed webpack-dev-server
staticconfig defaulting to watchpublic/directory unnecessarily. PR #1032 by ihabadham. Three bugs fixed: (1)staticnow defaults tofalseinstead of a misconfigured object that caused webpack-dev-server to watch thepublic/directory, which is already served by Rails viaActionDispatch::Static; (2) settingstatic: falseinshakapacker.ymlis no longer silently ignored; (3) the default template no longer includesstatic.watch, which was a v3→v4 migration artifact. Fixes #1031. - Fixed Rspack React Refresh plugin loading with
@rspack/plugin-react-refreshv2. PR #1116 by justin808. Shakapacker now reads the v2 namedReactRefreshRspackPluginexport while retaining compatibility with v1 direct/default CommonJS export shapes, preventingTypeError: ReactRefreshRspackPlugin is not a constructorduring rspack dev-server startup. - Widened
@rspack/plugin-react-refreshpeer range to^1.0.0 || ^2.0.0-0. PR #1091 by ihabadham. Fixes theERESOLVEconflict when installing@rspack/plugin-react-refresh@^2.0.0alongsideshakapacker@10.0.0. - Fixed
NodePackageVersion#find_versionfor local-pathshakapackerinstalls (e.g.yalc,file:, relative paths). PR #1086, PR #1106 by justin808. The version check now consultspackage.jsonfirst and short-circuits on../,./, andfile:dependencies, so stale lockfile semvers no longer trigger false gem↔node version mismatches.package_json_dependencyalso consultsdevDependenciesin addition todependencies. TheLOCAL_PATH_REGEXconstant replaces a duplicated inline regex and anchors both alternatives to the start of the string, removing a latent false-positive on version strings containing..mid-value. Fixes #1103. - Fix rspack setup not reusing certain shared webpack-rspack config settings. PR #1085 by brunodccarvalho. Default config changes include
optimization.splitChunks.chunks="all",optimization.runtimeChunk="single", the webpack compression plugin in production, and the removal of minimization plugins in development. Fixes #984. - Fixed Rspack Sass rule blocking
sass-embeddedusers by requiring thesasspackage. PR #1105 by justin808. Rspack Sass detection now only checks forsass-loader; the implementation (sass,sass-embedded, etc.) is resolved by the loader at build time, matching the webpack code path. - Fixed
bin/shakapacker-configandbin/diff-bundler-configin ESM apps and on upgraded apps. PR #1104, PR #1132 by justin808. Apps with"type": "module"inpackage.jsonfailed to run the JavaScript binstubs because Node parsed them as ESM. The binstubs are now Ruby wrappers that locate Node (without executing it during lookup) and invoke.cjspackage scripts shipped insidenode_modules/shakapacker/package/bin/. The wrappers also mapNODE_ENVfromRAILS_ENVand print useful messages for non-ErrorCLI rejections.shakapacker:export_bundler_configdispatches binstubs by shebang, so upgraded apps with legacy JavaScript binstubs continue to run via Node while Ruby wrappers run via Ruby. Existing apps with the old JavaScript binstubs should re-runbundle exec rake shakapacker:binstubsto install the new Ruby wrappers. Fixes #1123.