[v9.6.0] - March 7, 2026
Security
- Removed default
Access-Control-Allow-Origin: *header from dev server configuration. This header allowed any website to access dev server resources. If your setup runs webpack-dev-server on a different port from your Rails server, uncomment theheaderssection inconfig/shakapacker.ymlto restore cross-origin asset loading. PR #936 by justin808. Fixes #935.
Added
-
Added
SKIP=trueinstaller mode to preserve existing files. PR #926 by justin808. Runningrails shakapacker:install SKIP=truenow skips conflicting files instead of overwriting them. This is useful for CI/CD pipelines and automated setups where you want to install only missing files without touching existing configuration. -
Export bundler utility functions for Webpack/Rspack compatibility. PR #922 by justin808. New utility functions that make it easier to write bundler-agnostic configuration code:
isRspack,isWebpack,getBundler(),getCssExtractPlugin(),getCssExtractPluginLoader(),getDefinePlugin(),getEnvironmentPlugin(), andgetProvidePlugin(). Users no longer need to write conditional logic to handle differences between Webpack and Rspack.// Before: manual conditional logic const { config } = require("shakapacker") const CssPlugin = config.assets_bundler === "rspack" ? require("@rspack/core").CssExtractRspackPlugin : require("mini-css-extract-plugin") // After: use bundler utilities const { getCssExtractPlugin } = require("shakapacker") const CssPlugin = getCssExtractPlugin()
Changed
-
Changed default file rule type from
asset/resourcetoasset. PR #901 by justin808. Static assets (images, fonts, SVGs) now use webpack/rspack'sassettype instead ofasset/resource, allowing the bundler to automatically inline small files as data URIs for better performance. -
BREAKING: sass-loader now defaults to modern Sass API. PR #879 by justin808. The sass-loader configuration now uses
api: "modern"instead of the deprecated legacy API. This improves compatibility with plugins like sass-resources-loader that require the modern API. If you experience issues after upgrading, you can revert to the legacy API by customizing your webpack config:// config/webpack/webpack.config.js const { generateWebpackConfig } = require("shakapacker") const config = generateWebpackConfig() // Find and modify sass-loader options config.module.rules.forEach((rule) => { if (rule.use) { rule.use.forEach((loader) => { if (loader.loader?.includes("sass-loader")) { loader.options.api = "legacy" } }) } }) module.exports = config
Fixed
- Fixed hidden dotfiles and dot-directories being treated as entrypoints. PR #915 by justin808. Entry discovery now ignores files and directories whose names start with
.when traversingsource_entry_path, preventing unintended bundles from being created. Closes #853. - Fixed orphaned webpack/rspack processes when foreman receives SIGTERM. PR #888 by jordan-brough. When running under foreman, sending SIGTERM to foreman (e.g.
kill <pid>) would kill the Ruby shakapacker process but leave the webpack/rspack child process running as an orphan. DevServerRunner now usesexecto replace the Ruby process entirely, and Runner usesspawnwith SIGTERM forwarding to ensure the child process is properly terminated. - Fixed missing-environment fallback to use production instead of development. PR #894 by justin808. When a Rails environment (e.g., staging) is not defined in
shakapacker.yml, Shakapacker now falls back to theproductionconfiguration instead ofdevelopment. This ensures unknown environments get production-optimized webpack/rspack builds by default. - Fixed installer writing wrong shakapacker version in package.json. PR #899 by justin808. The
shakapacker:installgenerator now keeps thepackage.jsondependency value in sync with the exact version or path that was requested, instead of relying on the post-install value which could differ. - Fixed
privateOutputPathnot being computed in JavaScript config. PR #891 by ihabadham. Theprivate_output_pathsetting fromshakapacker.ymlis now properly resolved to an absolute path and exposed asprivateOutputPathin the JavaScript configuration, matching the behavior already present in the Ruby configuration. - Fixed installer not updating
shakapacker.ymlwhen selecting a non-default transpiler. PR #895 by codex-rs. Installing withJAVASCRIPT_TRANSPILER=babel(oresbuild) now correctly updatesconfig/shakapacker.ymlto match the selected transpiler instead of leaving it set toswc. Previously, a quote mismatch in thegsub_filecall meant the config was never actually updated, and the condition also excludedJAVASCRIPT_TRANSPILER=babelfrom the update entirely. Additionally,JAVASCRIPT_TRANSPILER=babelno longer installs SWC packages. - Fixed ENOENT crash on clean builds when using
webpack-assets-manifestv6 withmerge: true. PR #931 by justin808. Seeds an empty{}manifest file before instantiating the plugin, so the merge read succeeds on first build rather than throwing an unhandled ENOENT. - Improved error message when manifest is empty or missing. PR #872 by justin808. When the bundler is still compiling (empty manifest) or hasn't run yet (missing manifest file), users now see clear, actionable error messages instead of the generic 7-point checklist.
- Fixed NODE_ENV=test causing DefinePlugin warnings. PR #870 by justin808. When RAILS_ENV=test, Shakapacker now sets NODE_ENV=development instead of NODE_ENV=test. This prevents webpack/rspack DefinePlugin conflicts since these bundlers only recognize "development" and "production" as valid NODE_ENV values.
- Fixed
--jsonflag output being corrupted by log messages. PR #869 by justin808. When--jsonis in the command arguments,[Shakapacker]log messages are now written to stderr instead of stdout, keeping stdout clean for valid JSON output. This allowsbin/shakapacker --profile --jsonto be piped to tools likewebpack-bundle-analyzer. Normal (non-JSON) usage is unchanged. Resolves #868. - Require explicit truthy values for all installer env vars. PR #926, PR #943 by justin808. Previously, any set value (including
"false"or"0") would activate these flags. Now only explicit truthy values (true,1,yes, case-insensitive) are recognized forSKIP,FORCE,USE_BABEL_PACKAGES,SHAKAPACKER_USE_TYPESCRIPT, andSKIP_COMMON_LOADERS. This behavior change may require CI/scripts that relied on arbitrary non-empty values to switch to recognized truthy values liketrue.