shakapacker 9.3.1 → 9.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 827667fa6e3a24bab59f3d9c2ef8404755b0deed67e1fce8ec62ada24e9b1a51
4
- data.tar.gz: 06e18cd459b5e343601524ef2a1275ed0a86e6f842f63ef49d22e94fd7468ff2
3
+ metadata.gz: 0516b9d770d17a8e04f5b51e49f854823339760856dfd93a281586ea975513db
4
+ data.tar.gz: e0951145646eaeca52df5fc65aba8217e60de0ad0ea10de21271d6e7e62f7b6f
5
5
  SHA512:
6
- metadata.gz: ccc98e916ba625cc386091668bad5737376f0d031758ce44124f8c3a45f463e8e9dbdc2e42c302387b3f1f074a075524e9856e01295cd73ea1efa7ebf3f40469
7
- data.tar.gz: 5b256253fb6abd10007f861c6fc16a2a2500db40ca2a454cd75f8aeb89f83a13669394524cffb3cfffac6b490aa9a57f498358d3c57c0836d069072d208713eb
6
+ metadata.gz: 32963185a3ef79ffe8da898d800d9c014acc34854ad17dadb30243b5c46a6ae7caa74be034d1c9971048fab0809ba2caefae3ad82faa86d5684ed2dd46782a6c
7
+ data.tar.gz: 80f01b964e5df32104861c13a3e1924e497fa57f0201f4522417c407bc52bcf89e26315146d1e441fa5cd4a092994438aa2449ee95a07ba9c5c51eb6f48f830e
@@ -109,50 +109,58 @@ When a new version is released:
109
109
 
110
110
  ### For Regular Changelog Updates
111
111
 
112
- 1. **Determine the correct version tag to compare against**:
112
+ 1. **ALWAYS fetch latest changes first**:
113
+ - **CRITICAL**: Run `git fetch origin main` to ensure you have the latest commits
114
+ - The workspace may be behind origin/main, causing you to miss recently merged PRs
115
+ - After fetching, use `origin/main` for all comparisons, NOT local `main` branch
116
+
117
+ 2. **Determine the correct version tag to compare against**:
113
118
  - First, check the tag dates: `git log --tags --simplify-by-decoration --pretty="format:%ai %d" | head -10`
114
119
  - Find the latest version tag and its date
115
- - Compare main branch date to the tag date
116
- - If the tag is NEWER than main, it means main needs to be updated to include the tag's commits
120
+ - Compare origin/main branch date to the tag date
121
+ - If the tag is NEWER than origin/main, it means the branch needs to be updated to include the tag's commits
117
122
  - **CRITICAL**: Always use `git log TAG..BRANCH` to find commits that are in the tag but not in the branch, as the tag may be ahead
118
123
 
119
- 2. **Check commits and version boundaries**:
120
- - Run `git log --oneline LAST_TAG..main` to see commits since the last release
121
- - Also check `git log --oneline main..LAST_TAG` to see if the tag is ahead of main
124
+ 3. **Check commits and version boundaries**:
125
+ - **IMPORTANT**: Use `origin/main` in all commands below, not local `main`
126
+ - Run `git log --oneline LAST_TAG..origin/main` to see commits since the last release
127
+ - Also check `git log --oneline origin/main..LAST_TAG` to see if the tag is ahead of origin/main
122
128
  - If the tag is ahead, entries in "Unreleased" section may actually belong to that tagged version
123
- - Identify which commits contain user-visible changes
124
- - Extract PR numbers and author information from commit messages
125
- - **Never ask the user for PR details** - get them from the git history
129
+ - **Extract ALL PR numbers** from commit messages using grep: `git log --oneline LAST_TAG..origin/main | grep -oE "#[0-9]+" | sort -u`
130
+ - For each PR number found, check if it's already in CHANGELOG.md using: `grep "PR #XXX" CHANGELOG.md`
131
+ - Identify which commits contain user-visible changes (look for keywords like "Fix", "Add", "Feature", "Bug", etc.)
132
+ - Extract author information from commit messages
133
+ - **Never ask the user for PR details** - get them from the git history or use WebFetch on the PR URL
126
134
 
127
- 3. **Validate** that changes are user-visible (per the criteria above). If not user-visible, skip those commits.
135
+ 4. **Validate** that changes are user-visible (per the criteria above). If not user-visible, skip those commits.
128
136
 
129
- 4. **Read the current CHANGELOG.md** to understand the existing structure and formatting.
137
+ 5. **Read the current CHANGELOG.md** to understand the existing structure and formatting.
130
138
 
131
- 5. **Determine where entries should go**:
132
- - If the latest version tag is NEWER than main branch, move entries from "Unreleased" to that version section
133
- - If main is ahead of the latest tag, add new entries to "Unreleased"
139
+ 6. **Determine where entries should go**:
140
+ - If the latest version tag is NEWER than origin/main branch, move entries from "Unreleased" to that version section
141
+ - If origin/main is ahead of the latest tag, add new entries to "Unreleased"
134
142
  - Always verify the version date in CHANGELOG.md matches the actual tag date
135
143
 
136
- 6. **Add or move entries** to the appropriate section under appropriate category headings.
144
+ 7. **Add or move entries** to the appropriate section under appropriate category headings.
137
145
  - **CRITICAL**: When moving entries from "Unreleased" to a version section, merge them with existing entries under the same category heading
138
146
  - **NEVER create duplicate section headings** (e.g., don't create two "### Fixed" sections)
139
147
  - If the version section already has a category heading (e.g., "### Fixed"), add the moved entries to that existing section
140
148
  - Maintain the category order as defined above
141
149
 
142
- 7. **Verify formatting**:
150
+ 8. **Verify formatting**:
143
151
  - Bold description with period
144
152
  - Proper PR link
145
153
  - Proper author link
146
154
  - Consistent with existing entries
147
155
  - File ends with a newline character
148
156
 
149
- 8. **Run linting** after making changes:
157
+ 9. **Run linting** after making changes:
150
158
 
151
159
  ```bash
152
160
  yarn lint
153
161
  ```
154
162
 
155
- 9. **Show the user** the added or moved entries and explain what was done.
163
+ 10. **Show the user** the added or moved entries and explain what was done.
156
164
 
157
165
  ### For Beta to Non-Beta Version Release
158
166
 
data/CHANGELOG.md CHANGED
@@ -9,16 +9,23 @@
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ Changes since the last non-beta release.
13
+
12
14
  ### Fixed
13
15
 
14
- - Extended manifest merging for multiple client configurations to all environments. [PR #800](https://github.com/shakacode/shakapacker/pull/800) by [Judahmeek](https://github.com/Judahmeek).
16
+ - Use `@ts-ignore` to suppress potential import error in public types when `webpack` is not installed. [PR #828](https://github.com/shakacode/shakapacker/pull/828) by [G-Rath]
15
17
 
16
- Changes since the last non-beta release.
18
+ ## [v9.3.1] - November 9, 2025
19
+
20
+ ### Fixed
21
+
22
+ - **Fixed NODE_ENV not being set when running shakapacker-dev-server**. [PR #823](https://github.com/shakacode/shakapacker/pull/823) by [Seifeldin7](https://github.com/Seifeldin7). Resolves [#802](https://github.com/shakacode/shakapacker/issues/802). The dev server now properly initializes NODE_ENV to match RAILS_ENV (or "production" by default), fixing webpack configurations that dynamically load environment-specific files.
23
+ - Extended manifest merging for multiple client configurations to all environments. [PR #800](https://github.com/shakacode/shakapacker/pull/800) by [Judahmeek](https://github.com/Judahmeek).
17
24
 
18
25
  ### Added
19
26
 
20
27
  - **Support for `css_modules_export_mode` configuration option**. [PR #817](https://github.com/shakacode/shakapacker/pull/817) by [justin808](https://github.com/justin808). Adds `css_modules_export_mode` setting in `shakapacker.yml` to control CSS Modules export style. Set to `"named"` (default, v9+ behavior with true named exports) or `"default"` (v8 behavior with default export object). Allows teams to opt into v8-style exports for easier migration from v8 or when using TypeScript with strict type checking.
21
- - **`Configuration#data` public API method** with enhanced documentation and safety. [PR #820](https://github.com/shakacode/shakapacker/pull/820) by [justin808](https://github.com/justin808). The `Configuration#data` method is now part of the public Ruby API, providing stable access to raw configuration data. Returns a frozen hash with symbolized keys to prevent accidental mutations. Includes comprehensive test coverage and detailed RDoc documentation.
28
+ - **`Configuration#data` public API method** with enhanced documentation and safety. [PR #818](https://github.com/shakacode/shakapacker/pull/818) by [justin808](https://github.com/justin808). The `Configuration#data` method is now part of the public Ruby API, providing stable access to raw configuration data. Returns a frozen hash with symbolized keys to prevent accidental mutations. Includes comprehensive test coverage and detailed RDoc documentation.
22
29
  - **Support for `javascript_transpiler: 'none'`** for completely custom webpack configurations. [PR #799](https://github.com/shakacode/shakapacker/pull/799) by [justin808](https://github.com/justin808). Allows users with custom webpack configs to skip Shakapacker's transpiler setup and validation by setting `javascript_transpiler: 'none'` in `shakapacker.yml`. Useful when managing transpilation entirely outside of Shakapacker's defaults.
23
30
 
24
31
  ## [v9.3.0] - November 2, 2025
@@ -727,7 +734,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
727
734
 
728
735
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
729
736
 
730
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.3.0...main
737
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.3.1...main
738
+ [v9.3.1]: https://github.com/shakacode/shakapacker/compare/v9.3.0...v9.3.1
731
739
  [v9.3.0]: https://github.com/shakacode/shakapacker/compare/v9.2.0...v9.3.0
732
740
  [v9.2.0]: https://github.com/shakacode/shakapacker/compare/v9.1.0...v9.2.0
733
741
  [v9.1.0]: https://github.com/shakacode/shakapacker/compare/v9.0.0...v9.1.0
data/CONTRIBUTING.md CHANGED
@@ -105,34 +105,21 @@ Shakapacker uses optional peer dependencies (via `peerDependenciesMeta`) for max
105
105
 
106
106
  ### TypeScript Declaration Files and Optional Dependencies
107
107
 
108
- When importing types from optional peer dependencies, we use `@ts-expect-error` directives:
108
+ When importing types from optional peer dependencies, we use `@ts-ignore` directives:
109
109
 
110
110
  ```typescript
111
- // @ts-expect-error: webpack is an optional peer dependency (using type-only import)
111
+ // @ts-ignore: webpack is an optional peer dependency (using type-only import)
112
112
  import type { Configuration } from "webpack"
113
113
  ```
114
114
 
115
- **Important behavior:**
116
-
117
- - **In development** (webpack installed): TypeScript doesn't error, but `@ts-expect-error` expects one → TypeScript compilation will fail
118
- - **In production** (webpack not installed): TypeScript errors on import, `@ts-expect-error` suppresses it → TypeScript compilation succeeds
119
-
120
- This is counterintuitive but correct. Our CI validates both scenarios to ensure the behavior works as expected.
121
-
122
- **Example scenario:**
123
-
124
- If webpack were changed from optional to required in `package.json`:
125
-
126
- - Development builds would fail with: `error TS2578: Unused '@ts-expect-error' directive`
127
- - This surfaces the dependency change immediately, preventing accidental breakage
128
- - The build failure prompts developers to remove the `@ts-expect-error` directive
115
+ This ensures that typecheck downstream won't fail if lib checks are on regardless of if `webpack` is available.
129
116
 
130
117
  ### When modifying dependencies:
131
118
 
132
119
  1. Add new peer dependencies to both `peerDependencies` and `peerDependenciesMeta` (marking as optional)
133
120
  2. Keep version ranges synchronized between `devDependencies` and `peerDependencies`
134
121
  3. Test with multiple package managers: `npm`, `yarn`, and `pnpm`
135
- 4. If adding type-only imports from optional dependencies, use the `@ts-expect-error` pattern shown above
122
+ 4. If adding type-only imports from optional dependencies, use the `@ts-ignore` pattern shown above
136
123
 
137
124
  ### Testing peer dependency changes:
138
125
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shakapacker (9.3.1)
4
+ shakapacker (9.3.2)
5
5
  activesupport (>= 5.2)
6
6
  package_json
7
7
  rack-proxy (>= 0.6.1)
data/README.md CHANGED
@@ -163,7 +163,7 @@ Then run the following to install Shakapacker:
163
163
 
164
164
  ```bash
165
165
  ./bin/bundle install
166
- ./bin/rails shakapacker:install
166
+ bundle exec rake shakapacker:install
167
167
  ```
168
168
 
169
169
  Before initiating the installation process, ensure you have committed all the changes. While installing Shakapacker, there might be some conflict between the existing file content and what Shakapacker tries to copy. You can either approve all the prompts for overriding these files or use the `FORCE=true` environment variable before the installation command to force the override without any prompt.
@@ -282,12 +282,10 @@ Depending on your setup, you'll need different subsets of the optional peer depe
282
282
  **Quick tip:** You can easily switch between webpack and rspack using:
283
283
 
284
284
  ```bash
285
- rails shakapacker:switch_bundler rspack --install-deps
286
- # or with rake (note the -- separator)
287
- rake shakapacker:switch_bundler rspack -- --install-deps
285
+ bundle exec rake shakapacker:switch_bundler rspack -- --install-deps
288
286
 
289
287
  # For faster switching, use --no-uninstall to keep both bundlers installed
290
- rails shakapacker:switch_bundler webpack --install-deps --no-uninstall
288
+ bundle exec rake shakapacker:switch_bundler webpack -- --install-deps --no-uninstall
291
289
  ```
292
290
 
293
291
  See the [Rspack Migration Guide](./docs/rspack_migration_guide.md) for details.
@@ -1117,13 +1115,13 @@ Otherwise, Shakapacker will use the production environment as a fallback environ
1117
1115
  For example, the below command will compile assets in production mode but will use staging configurations from `config/shakapacker.yml` if available or use fallback production environment configuration:
1118
1116
 
1119
1117
  ```bash
1120
- RAILS_ENV=staging bundle exec rails assets:precompile
1118
+ RAILS_ENV=staging bundle exec rake assets:precompile
1121
1119
  ```
1122
1120
 
1123
1121
  And, this will compile in development mode and load configuration for the cucumber environment if defined in `shakapacker.yml` or fallback to production configuration
1124
1122
 
1125
1123
  ```bash
1126
- RAILS_ENV=cucumber NODE_ENV=development bundle exec rails assets:precompile
1124
+ RAILS_ENV=cucumber NODE_ENV=development bundle exec rake assets:precompile
1127
1125
  ```
1128
1126
 
1129
1127
  Please note, binstubs compiles in development mode however rake tasks compiles in production mode.
@@ -1134,8 +1132,8 @@ Please note, binstubs compiles in development mode however rake tasks compiles i
1134
1132
  ./bin/shakapacker-dev-server
1135
1133
 
1136
1134
  # Compiles in production mode by default unless NODE_ENV is specified, per `lib/tasks/shakapacker/compile.rake`
1137
- bundle exec rails assets:precompile
1138
- bundle exec rails shakapacker:compile
1135
+ bundle exec rake assets:precompile
1136
+ bundle exec rake shakapacker:compile
1139
1137
  ```
1140
1138
 
1141
1139
  ### Upgrading
@@ -1147,7 +1145,7 @@ You can run the following commands to upgrade Shakapacker to the latest stable v
1147
1145
  bundle update shakapacker
1148
1146
 
1149
1147
  # overwrite your changes to the default install files and revert any unwanted changes from the install
1150
- rails shakapacker:install
1148
+ bundle exec rake shakapacker:install
1151
1149
 
1152
1150
  # using npm
1153
1151
  npm install shakapacker@latest
@@ -1294,7 +1292,7 @@ For detailed CDN setup instructions, including CloudFlare configuration, trouble
1294
1292
 
1295
1293
  ```bash
1296
1294
  export SHAKAPACKER_ASSET_HOST=https://cdn.example.com
1297
- RAILS_ENV=production bundle exec rails assets:precompile
1295
+ RAILS_ENV=production bundle exec rake assets:precompile
1298
1296
  ```
1299
1297
 
1300
1298
  For more deployment documentation, see [Deployment](./docs/deployment.md).
@@ -1348,3 +1346,10 @@ The following companies support our Open Source projects, and ShakaCode uses the
1348
1346
  <a href="https://www.honeybadger.io">
1349
1347
  <img src="https://user-images.githubusercontent.com/4244251/184881133-79ee9c3c-8165-4852-958e-31687b9536f4.png" alt="Honeybadger" height="55px">
1350
1348
  </a>
1349
+ <a href="https://coderabbit.ai">
1350
+ <picture>
1351
+ <source media="(prefers-color-scheme: dark)" srcset="https://victorious-bubble-f69a016683.media.strapiapp.com/White_Typemark_7229870ac5.svg">
1352
+ <source media="(prefers-color-scheme: light)" srcset="https://victorious-bubble-f69a016683.media.strapiapp.com/Orange_Typemark_7958cfa790.svg">
1353
+ <img alt="CodeRabbit" src="https://victorious-bubble-f69a016683.media.strapiapp.com/Orange_Typemark_7958cfa790.svg" height="55px">
1354
+ </picture>
1355
+ </a>
data/docs/cdn_setup.md CHANGED
@@ -91,7 +91,7 @@ During deployment, compile your assets as usual:
91
91
  ```bash
92
92
  # The SHAKAPACKER_ASSET_HOST will be used during compilation
93
93
  # to set the webpack publicPath
94
- RAILS_ENV=production bundle exec rails assets:precompile
94
+ RAILS_ENV=production bundle exec rake assets:precompile
95
95
  ```
96
96
 
97
97
  This ensures that:
@@ -204,7 +204,7 @@ import("./components/HeavyComponent").then((module) => {
204
204
  **Solutions**:
205
205
 
206
206
  1. Ensure you set `SHAKAPACKER_ASSET_HOST` **before** running `assets:precompile`
207
- 2. Clear Rails cache: `rails tmp:cache:clear`
207
+ 2. Clear Rails cache: `bundle exec rake tmp:cache:clear`
208
208
  3. Check the manifest.json file includes CDN URLs:
209
209
  ```bash
210
210
  cat public/packs/manifest.json
@@ -369,7 +369,7 @@ end
369
369
  ```bash
370
370
  # Deployment script
371
371
  export SHAKAPACKER_ASSET_HOST=https://cdn.example.com
372
- RAILS_ENV=production bundle exec rails assets:precompile
372
+ RAILS_ENV=production bundle exec rake assets:precompile
373
373
  ```
374
374
 
375
375
  ## Summary
@@ -411,16 +411,15 @@ bin/shakapacker compile
411
411
  Shakapacker provides a convenient rake task to automate the migration:
412
412
 
413
413
  ```bash
414
- # Switch to rspack with automatic dependency management
415
- rails shakapacker:switch_bundler rspack --install-deps
416
-
417
- # Or with rake (note the -- separator)
418
- rake shakapacker:switch_bundler rspack -- --install-deps
414
+ # Switch to rspack with automatic dependency management (note the -- separator)
415
+ bin/rake shakapacker:switch_bundler rspack -- --install-deps
419
416
 
420
417
  # Fast switching without uninstalling webpack (keeps both)
421
- rails shakapacker:switch_bundler rspack --install-deps --no-uninstall
418
+ bin/rake shakapacker:switch_bundler rspack -- --install-deps --no-uninstall
422
419
  ```
423
420
 
421
+ > **⚠️ Important:** This task must be run with `bin/rake`, not `bin/rails`.
422
+
424
423
  The task will:
425
424
 
426
425
  - Update `config/shakapacker.yml` to use rspack
@@ -432,7 +431,7 @@ The task will:
432
431
  **Custom dependencies:** You can customize which dependencies are installed:
433
432
 
434
433
  ```bash
435
- rails shakapacker:switch_bundler --init-config
434
+ bin/rake shakapacker:switch_bundler -- --init-config
436
435
  ```
437
436
 
438
437
  #### 2. Manual installation (alternative)
@@ -36,7 +36,7 @@ Common configuration options with their defaults:
36
36
  | `compiler_strategy` | string | `"mtime"` (dev), `"digest"` (prod) | How to determine if recompilation is needed |
37
37
  | `useContentHash` | boolean | `false` (dev), `true` (prod) | Include content hashes in asset filenames |
38
38
  | `webpack_compile_output` | boolean | `true` | Show webpack/rspack compilation output |
39
- | `shakapacker_precompile` | boolean | `true` | Include in `rails assets:precompile` |
39
+ | `shakapacker_precompile` | boolean | `true` | Include in `bundle exec rake assets:precompile` |
40
40
  | `ensure_consistent_versioning` | boolean | `true` | Enforce gem/npm version matching |
41
41
  | `dev_server.host` | string | `"localhost"` | Development server host |
42
42
  | `dev_server.port` | number | `3035` | Development server port |
@@ -401,7 +401,7 @@ production:
401
401
  **Type:** `boolean`
402
402
  **Default:** `true`
403
403
 
404
- Whether `rails assets:precompile` should compile webpack/rspack assets.
404
+ Whether `bundle exec rake assets:precompile` should compile webpack/rspack assets.
405
405
 
406
406
  ```yaml
407
407
  # Include in assets:precompile (recommended)
@@ -414,7 +414,7 @@ shakapacker_precompile: false
414
414
  **Override via environment variable:**
415
415
 
416
416
  ```bash
417
- SHAKAPACKER_PRECOMPILE=false rails assets:precompile
417
+ SHAKAPACKER_PRECOMPILE=false bundle exec rake assets:precompile
418
418
  ```
419
419
 
420
420
  ### `cache_manifest`
data/docs/deployment.md CHANGED
@@ -16,7 +16,7 @@ Quick example for production deployment:
16
16
  ```yaml
17
17
  # config/shakapacker.yml
18
18
  production:
19
- precompile_hook: "bin/rails react_on_rails:generate_packs"
19
+ precompile_hook: "bin/rake react_on_rails:generate_packs"
20
20
  ```
21
21
 
22
22
  This ensures your dynamic entry points are generated before `assets:precompile` runs.
@@ -56,7 +56,7 @@ Your production build process is responsible for installing your JavaScript depe
56
56
  RAILS_ENV=staging bin/shakapacker
57
57
 
58
58
  # Also works with rake task
59
- RAILS_ENV=staging bundle exec rails assets:precompile
59
+ RAILS_ENV=staging bundle exec rake assets:precompile
60
60
  ```
61
61
 
62
62
  **How it works:**
@@ -156,7 +156,7 @@ Shakapacker supports serving JavaScript bundles and assets from a CDN. For a com
156
156
 
157
157
  ```bash
158
158
  export SHAKAPACKER_ASSET_HOST=https://cdn.example.com
159
- RAILS_ENV=production bundle exec rails assets:precompile
159
+ RAILS_ENV=production bundle exec rake assets:precompile
160
160
  ```
161
161
 
162
162
  Note: Shakapacker does NOT use the `ASSET_HOST` environment variable. You must use `SHAKAPACKER_ASSET_HOST` instead (`WEBPACKER_ASSET_HOST` if using Shakapacker before v7).
@@ -399,7 +399,7 @@ development: # or production
399
399
  bundle exec puma --early-hints
400
400
 
401
401
  # Option 2: Test in production mode locally (more realistic)
402
- RAILS_ENV=production rails assets:precompile # Compile assets first
402
+ RAILS_ENV=production bundle exec rake assets:precompile # Compile assets first
403
403
  RAILS_ENV=production bundle exec puma --early-hints -e production
404
404
  ```
405
405
 
@@ -434,7 +434,7 @@ curl http://localhost:3035/packs/application.js
434
434
 
435
435
  Use this checklist to verify a complete Shakapacker setup:
436
436
 
437
- - [ ] **Assets compile:** `bundle exec rails assets:precompile` succeeds
437
+ - [ ] **Assets compile:** `bundle exec rake assets:precompile` succeeds
438
438
  - [ ] **Manifest exists:** `public/packs/manifest.json` contains entrypoints
439
439
  - [ ] **Assets load:** Page loads without 404s for pack files
440
440
  - [ ] **Code splitting works:** Multiple chunks load in Network tab
@@ -456,7 +456,7 @@ cat public/packs/manifest.json | jq .
456
456
  **Recompile:**
457
457
 
458
458
  ```bash
459
- bundle exec rails assets:precompile
459
+ bundle exec rake assets:precompile
460
460
  ```
461
461
 
462
462
  ### Old Assets Cached
@@ -465,7 +465,7 @@ bundle exec rails assets:precompile
465
465
 
466
466
  ```bash
467
467
  rm -rf public/packs
468
- bundle exec rails assets:precompile
468
+ bundle exec rake assets:precompile
469
469
  ```
470
470
 
471
471
  ### Dev Server Won't Start
@@ -102,7 +102,7 @@ If upgrading from Shakapacker v8:
102
102
 
103
103
  ### New Installations
104
104
 
105
- The installer (`rails shakapacker:install`) only adds packages needed for your configuration:
105
+ The installer (`bundle exec rake shakapacker:install`) only adds packages needed for your configuration:
106
106
 
107
107
  - Detects your preferred bundler (webpack/rspack)
108
108
  - Installs appropriate JavaScript transpiler (babel/swc/esbuild)
@@ -159,7 +159,7 @@ The test suite includes:
159
159
 
160
160
  1. Check you've installed required dependencies for your configuration
161
161
  2. Refer to the configuration examples above
162
- 3. Run `rails shakapacker:doctor` for diagnostics
162
+ 3. Run `bundle exec rake shakapacker:doctor` for diagnostics
163
163
 
164
164
  ### TypeScript errors?
165
165
 
@@ -14,14 +14,14 @@ This is useful for:
14
14
 
15
15
  The precompile hook is especially useful when you need to run commands like:
16
16
 
17
- - `bin/rails react_on_rails:generate_packs` - Generate dynamic entry points
18
- - `bin/rails react_on_rails:locale` - Generate locale files
17
+ - `bin/rake react_on_rails:generate_packs` - Generate dynamic entry points
18
+ - `bin/rake react_on_rails:locale` - Generate locale files
19
19
  - Any custom script that prepares files before asset compilation
20
20
 
21
21
  **Important:** The hook runs in **both development and production**:
22
22
 
23
23
  - **Development**: Runs before `bin/shakapacker --watch` or dev server starts
24
- - **Production**: Runs before `rails assets:precompile`
24
+ - **Production**: Runs before `bundle exec rake assets:precompile`
25
25
 
26
26
  ## Configuration
27
27
 
@@ -39,7 +39,7 @@ development:
39
39
 
40
40
  production:
41
41
  <<: *default
42
- precompile_hook: "bin/rails react_on_rails:generate_packs"
42
+ precompile_hook: "rake react_on_rails:generate_packs"
43
43
  ```
44
44
 
45
45
  ## Creating a Precompile Hook Script
@@ -51,8 +51,8 @@ production:
51
51
  # bin/shakapacker-precompile-hook
52
52
 
53
53
  echo "Preparing assets..."
54
- bin/rails react_on_rails:generate_packs
55
- bin/rails react_on_rails:locale
54
+ bundle exec rake react_on_rails:generate_packs
55
+ bundle exec rake react_on_rails:locale
56
56
  echo "Assets prepared successfully"
57
57
  ```
58
58
 
@@ -117,14 +117,14 @@ For React on Rails projects, the hook replaces manual steps in your workflow:
117
117
 
118
118
  ```bash
119
119
  # Development
120
- bin/rails react_on_rails:generate_packs
121
- bin/rails react_on_rails:locale
120
+ bundle exec rake react_on_rails:generate_packs
121
+ bundle exec rake react_on_rails:locale
122
122
  bin/shakapacker-dev-server
123
123
 
124
124
  # Production
125
- bin/rails react_on_rails:generate_packs
126
- bin/rails react_on_rails:locale
127
- RAILS_ENV=production bin/rails assets:precompile
125
+ bundle exec rake react_on_rails:generate_packs
126
+ bundle exec rake react_on_rails:locale
127
+ RAILS_ENV=production rake assets:precompile
128
128
  ```
129
129
 
130
130
  ### After (Automatic)
@@ -138,8 +138,8 @@ default: &default
138
138
  ```bash
139
139
  #!/usr/bin/env bash
140
140
  # bin/react-on-rails-hook
141
- bin/rails react_on_rails:generate_packs
142
- bin/rails react_on_rails:locale
141
+ bundle exec rake react_on_rails:generate_packs
142
+ bundle exec rake react_on_rails:locale
143
143
  ```
144
144
 
145
145
  Now simply run:
@@ -149,7 +149,7 @@ Now simply run:
149
149
  bin/shakapacker-dev-server
150
150
 
151
151
  # Production
152
- RAILS_ENV=production bin/rails assets:precompile
152
+ RAILS_ENV=production bin/rake assets:precompile
153
153
  ```
154
154
 
155
155
  ## Security
@@ -292,7 +292,7 @@ default:
292
292
 
293
293
  if [ "$RAILS_ENV" = "production" ]; then
294
294
  echo "Running production-specific setup..."
295
- bin/rails react_on_rails:generate_packs
295
+ bin/rake react_on_rails:generate_packs
296
296
  else
297
297
  echo "Running development setup..."
298
298
  # Lighter-weight setup for development
data/docs/react.md CHANGED
@@ -132,7 +132,7 @@ rails new myapp --skip-javascript
132
132
  cd myapp
133
133
  bundle add shakapacker --strict
134
134
  ./bin/bundle install
135
- ./bin/rails shakapacker:install
135
+ bundle exec rake shakapacker:install
136
136
  npm install react react-dom @babel/preset-react
137
137
  npm install css-loader style-loader mini-css-extract-plugin css-minimizer-webpack-plugin
138
138
  ```
data/docs/releasing.md CHANGED
@@ -36,16 +36,16 @@ The automated release task handles the entire release process:
36
36
 
37
37
  ```bash
38
38
  # For a specific version (e.g., 9.1.0)
39
- rake create_release[9.1.0]
39
+ bundle exec rake create_release[9.1.0]
40
40
 
41
41
  # For a beta release (note: use period, not dash)
42
- rake create_release[9.2.0.beta.1] # Creates npm package 9.2.0-beta.1
42
+ bundle exec rake create_release[9.2.0.beta.1] # Creates npm package 9.2.0-beta.1
43
43
 
44
44
  # For a patch version bump (auto-increments)
45
- rake create_release
45
+ bundle exec rake create_release
46
46
 
47
47
  # Dry run to test without publishing
48
- rake create_release[9.1.0,true]
48
+ bundle exec rake create_release[9.1.0,true]
49
49
  ```
50
50
 
51
51
  ### 3. What the Release Task Does
@@ -83,13 +83,13 @@ The task automatically converts Ruby gem format to npm semver format:
83
83
 
84
84
  ```bash
85
85
  # Regular release
86
- rake create_release[9.1.0] # Gem: 9.1.0, npm: 9.1.0
86
+ bundle exec rake create_release[9.1.0] # Gem: 9.1.0, npm: 9.1.0
87
87
 
88
88
  # Beta release
89
- rake create_release[9.2.0.beta.1] # Gem: 9.2.0.beta.1, npm: 9.2.0-beta.1
89
+ bundle exec rake create_release[9.2.0.beta.1] # Gem: 9.2.0.beta.1, npm: 9.2.0-beta.1
90
90
 
91
91
  # Release candidate
92
- rake create_release[10.0.0.rc.1] # Gem: 10.0.0.rc.1, npm: 10.0.0-rc.1
92
+ bundle exec rake create_release[10.0.0.rc.1] # Gem: 10.0.0.rc.1, npm: 10.0.0-rc.1
93
93
  ```
94
94
 
95
95
  ### 5. During the Release
@@ -212,28 +212,22 @@ Shakapacker provides a convenient rake task to switch between webpack and rspack
212
212
 
213
213
  ```bash
214
214
  # Switch to rspack with automatic dependency management
215
- rails shakapacker:switch_bundler rspack --install-deps
216
- # or with rake (note the -- separator)
217
- rake shakapacker:switch_bundler rspack -- --install-deps
215
+ bin/rake shakapacker:switch_bundler rspack -- --install-deps
218
216
 
219
217
  # Fast switching without uninstalling old bundler (keeps both)
220
- rails shakapacker:switch_bundler webpack --install-deps --no-uninstall
221
- rake shakapacker:switch_bundler rspack -- --install-deps --no-uninstall
218
+ bin/rake shakapacker:switch_bundler rspack -- --install-deps --no-uninstall
222
219
 
223
220
  # Switch to rspack manually (you manage dependencies yourself)
224
- rails shakapacker:switch_bundler rspack
225
- rake shakapacker:switch_bundler rspack
221
+ bin/rake shakapacker:switch_bundler rspack
226
222
 
227
223
  # Switch back to webpack if needed
228
- rails shakapacker:switch_bundler webpack --install-deps
229
- rake shakapacker:switch_bundler webpack -- --install-deps
224
+ bin/rake shakapacker:switch_bundler webpack -- --install-deps
230
225
 
231
226
  # Show help
232
- rails shakapacker:switch_bundler --help
233
- rake shakapacker:switch_bundler -- --help
227
+ bin/rake shakapacker:switch_bundler -- --help
234
228
  ```
235
229
 
236
- **Note:** When using `rake`, you must use `--` to separate rake options from task arguments.
230
+ > **⚠️ Important:** This task must be run with `bin/rake`, not `bin/rails`.
237
231
 
238
232
  The task will:
239
233
 
@@ -246,7 +240,7 @@ The task will:
246
240
  **Custom Dependencies:** You can customize which dependencies are installed by creating a `.shakapacker-switch-bundler-dependencies.yml` file:
247
241
 
248
242
  ```bash
249
- rails shakapacker:switch_bundler --init-config
243
+ bundle exec rake shakapacker:switch_bundler --init-config
250
244
  ```
251
245
 
252
246
  ### Manual Migration Steps
@@ -840,7 +834,7 @@ To compare your webpack and rspack configurations during migration:
840
834
  bin/shakapacker-config --doctor
841
835
 
842
836
  # Switch to rspack
843
- rails shakapacker:switch_bundler rspack --install-deps
837
+ bundle exec rake shakapacker:switch_bundler rspack --install-deps
844
838
 
845
839
  # Export rspack configs to compare
846
840
  bin/shakapacker-config --doctor
@@ -280,7 +280,7 @@ See the [deployment guide](./deployment.md#custom-rails-environments-eg-staging)
280
280
  ## ENOENT: no such file or directory - node-sass
281
281
 
282
282
  If you get the error `ENOENT: no such file or directory - node-sass` on deploy with
283
- `assets:precompile` or `bundle exec rails shakapacker:compile` you may need to
283
+ `assets:precompile` or `bundle exec rake shakapacker:compile` you may need to
284
284
  move Sass to production `dependencies`.
285
285
 
286
286
  Move any packages that related to Sass (e.g. `node-sass` or `sass-loader`) from
@@ -326,13 +326,13 @@ In `package.json`:
326
326
 
327
327
  ## webpack or webpack-dev-server not found
328
328
 
329
- - This could happen if `shakapacker:install` step is skipped. Please run `bundle exec rails shakapacker:install` to fix the issue.
329
+ - This could happen if `shakapacker:install` step is skipped. Please run `bundle exec rake shakapacker:install` to fix the issue.
330
330
 
331
331
  - If you encounter the above error on heroku after upgrading from Rails 4.x to 5.1.x, then the problem might be related to missing `yarn` binstub. Please run following commands to update/add binstubs:
332
332
 
333
333
  ```bash
334
334
  bundle config --delete bin
335
- ./bin/rails app:update:bin # or rails app:update:bin
335
+ bundle exec rake app:update:bin
336
336
  ```
337
337
 
338
338
  ## Running webpack on Windows