Summary
shakapacker:doctor reports false issues for apps that use a custom hybrid bundler setup instead of Shakapacker's generated transpiler defaults.
In our app:
- Rspack uses built-in SWC
- a legacy path still intentionally uses Babel
- both webpack and rspack are installed on purpose
- assets compile successfully
But shakapacker:doctor reports:
Missing required dependency '@swc/core' for SWC transpiler
Missing required dependency 'swc-loader' for SWC with webpack
and warnings like:
Both SWC and Babel dependencies are installed. Consider removing Babel dependencies to reduce node_modules size
Both webpack and rspack are installed - ensure assets_bundler is set correctly
Why this looks incorrect
The app does not set assets_bundler or javascript_transpiler in config/shakapacker.yml, and uses a custom config layer instead.
Relevant behavior in doctor.rb:
- if
javascript_transpiler is unset, doctor assumes swc
- if
assets_bundler is unset, config falls back to webpack
- that combination causes doctor to require
@swc/core and swc-loader
However, in our actual config:
- webpack path does not use SWC
- rspack path uses
builtin:swc-loader
- Babel is still intentionally used for a legacy loader path
So doctor is validating its own inferred defaults rather than the app's real build behavior.
Relevant code paths
In Shakapacker 10.0.0:
lib/shakapacker/doctor.rb
check_javascript_transpiler_dependencies
check_swc_dependencies
check_transpiler_config_consistency
In our app:
- custom wrapper config delegates webpack and rspack to a shared config
- Rspack sets
process.env.USE_RSPACK = 'true'
- shared rules choose:
builtin:swc-loader for Rspack
babel-loader for a legacy path
Evidence
Despite the doctor output, the upgraded setup builds successfully:
shakapacker gem: 10.0.0
- npm
shakapacker: 10.0.0
@rspack/core: 2.0.0-rc.1
@rspack/cli: 2.0.0-rc.1
@rspack/dev-server: 2.0.0-rc.2
pnpm run rspack-dev completed successfully with all bundles compiling.
Suggestion
It seems like doctor should either:
- avoid raising SWC dependency issues when the app is clearly using a custom config rather than Shakapacker-managed transpiler selection, or
- downgrade these to hints or warnings when
javascript_transpiler and assets_bundler are only inferred defaults, or
- document that custom hybrid configs should explicitly set
javascript_transpiler: none or another value to suppress these checks, if that is the intended contract
Right now the output suggests missing dependencies that are not actually required for a working custom setup.
Summary
shakapacker:doctorreports false issues for apps that use a custom hybrid bundler setup instead of Shakapacker's generated transpiler defaults.In our app:
But
shakapacker:doctorreports:Missing required dependency '@swc/core' for SWC transpilerMissing required dependency 'swc-loader' for SWC with webpackand warnings like:
Both SWC and Babel dependencies are installed. Consider removing Babel dependencies to reduce node_modules sizeBoth webpack and rspack are installed - ensure assets_bundler is set correctlyWhy this looks incorrect
The app does not set
assets_bundlerorjavascript_transpilerinconfig/shakapacker.yml, and uses a custom config layer instead.Relevant behavior in
doctor.rb:javascript_transpileris unset, doctor assumesswcassets_bundleris unset, config falls back towebpack@swc/coreandswc-loaderHowever, in our actual config:
builtin:swc-loaderSo doctor is validating its own inferred defaults rather than the app's real build behavior.
Relevant code paths
In Shakapacker 10.0.0:
lib/shakapacker/doctor.rbcheck_javascript_transpiler_dependenciescheck_swc_dependenciescheck_transpiler_config_consistencyIn our app:
process.env.USE_RSPACK = 'true'builtin:swc-loaderfor Rspackbabel-loaderfor a legacy pathEvidence
Despite the doctor output, the upgraded setup builds successfully:
shakapackergem:10.0.0shakapacker:10.0.0@rspack/core:2.0.0-rc.1@rspack/cli:2.0.0-rc.1@rspack/dev-server:2.0.0-rc.2pnpm run rspack-devcompleted successfully with all bundles compiling.Suggestion
It seems like doctor should either:
javascript_transpilerandassets_bundlerare only inferred defaults, orjavascript_transpiler: noneor another value to suppress these checks, if that is the intended contractRight now the output suggests missing dependencies that are not actually required for a working custom setup.