Skip to content

Commit bdd63f3

Browse files
authored
Prepare v9.1.0 release (#665)
* Update CHANGELOG and migration guide for v9.1.0 release - Change Unreleased section to v9.1.0 with October 8, 2025 date - Add prominent warning about SWC loose mode breaking change - Add dedicated section in v9 upgrade guide explaining the breaking change - Link from CHANGELOG to migration guide for detailed instructions - Clarify that most projects need no changes - Explain impact on Stimulus users and spread operators This ensures users upgrading from v9.0.0 to v9.1.0 are aware of the breaking change and know how to handle it if needed.
1 parent 7b15eb5 commit bdd63f3

4 files changed

Lines changed: 662 additions & 296 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,30 @@
1111

1212
Changes since the last non-beta release.
1313

14+
_No unreleased changes._
15+
16+
## [v9.1.0] - October 8, 2025
17+
18+
**⚠️ IMPORTANT:** This release includes a breaking change for SWC users. Please see the [v9 Upgrade Guide - SWC Loose Mode Breaking Change](./docs/v9_upgrade.md#swc-loose-mode-breaking-change-v910) for migration details.
19+
1420
### ⚠️ Breaking Changes
1521

16-
- **SWC default configuration now uses `loose: false` for spec-compliant transforms** ([#657](https://github.com/shakacode/shakapacker/issues/657))
22+
- **SWC default configuration now uses `loose: false` for spec-compliant transforms** ([#658](https://github.com/shakacode/shakapacker/pull/658))
1723
- Previously, Shakapacker set `loose: true` by default in SWC configuration, which caused:
1824
- Silent failures with Stimulus controllers
1925
- Incorrect behavior with spread operators on iterables (e.g., `[...new Set()]`)
2026
- Deviation from both SWC and Babel upstream defaults
2127
- Now defaults to `loose: false`, matching SWC's default and fixing compatibility with Stimulus
2228
- This aligns with the previous fix to Babel configuration in [PR #107](https://github.com/shakacode/shakapacker/pull/107)
23-
- **Migration:** If you need the old behavior for performance reasons, add to `config/swc.config.js`:
29+
- **Migration:** Most projects need no changes as the new default provides spec-compliant behavior. Projects with Stimulus will benefit from this fix. See [v9 Upgrade Guide - SWC Loose Mode](./docs/v9_upgrade.md#swc-loose-mode-breaking-change-v910) for details
30+
- If you must restore the old behavior (not recommended), add to `config/swc.config.js`:
2431
```javascript
2532
module.exports = {
2633
options: {
2734
jsc: {
28-
loose: true // Restore old behavior (not recommended)
35+
// Only use this if you have code that requires loose transforms.
36+
// This provides slightly faster build performance but may cause runtime bugs.
37+
loose: true // Restore v9.0.0 behavior
2938
}
3039
}
3140
}
@@ -47,16 +56,16 @@ Changes since the last non-beta release.
4756
- Secure command execution (prevents shell injection)
4857
- Usage: `rails shakapacker:switch_bundler [webpack|rspack] [--install-deps] [--no-uninstall]`
4958
- See rake task help: `rails shakapacker:switch_bundler --help`
50-
- **Stimulus compatibility built into SWC migration** ([#657](https://github.com/shakacode/shakapacker/issues/657))
59+
- **Stimulus compatibility built into SWC migration** ([#658](https://github.com/shakacode/shakapacker/pull/658))
5160
- `rake shakapacker:migrate_to_swc` now creates `config/swc.config.js` with `keepClassNames: true`
5261
- Prevents SWC from mangling class names, which breaks Stimulus controller discovery
5362
- Includes React Fast Refresh configuration by default
54-
- **Comprehensive Stimulus documentation** for SWC users ([#657](https://github.com/shakacode/shakapacker/issues/657))
55-
- Added "Using SWC with Stimulus" section to `docs/using_swc_loader.md`
63+
- **Comprehensive Stimulus documentation** for SWC users ([#658](https://github.com/shakacode/shakapacker/pull/658))
64+
- Added "Using SWC with Stimulus" section to [docs/using_swc_loader.md](./docs/using_swc_loader.md#using-swc-with-stimulus)
5665
- Documents symptoms of missing configuration (silent failures)
5766
- Explains common errors like `env` and `jsc.target` conflicts
5867
- Added Stimulus compatibility checklist to migration guide
59-
- **Enhanced `rake shakapacker:doctor` for SWC configuration validation** ([#657](https://github.com/shakacode/shakapacker/issues/657))
68+
- **Enhanced `rake shakapacker:doctor` for SWC configuration validation** ([#658](https://github.com/shakacode/shakapacker/pull/658))
6069
- Detects `loose: true` in config and warns about potential issues
6170
- Detects missing `keepClassNames: true` when Stimulus is installed
6271
- Detects conflicting `jsc.target` and `env` configuration

docs/v9_upgrade.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This guide outlines new features, breaking changes, and migration steps for upgrading from Shakapacker v8 to v9.
44

5+
> **⚠️ Important for v9.1.0 Users:** If you're upgrading to v9.1.0 or later, please note the [SWC Configuration Breaking Change](#swc-loose-mode-breaking-change-v910) below. This affects users who previously configured SWC in v9.0.0.
6+
57
## New Features
68

79
### TypeScript Support
@@ -41,6 +43,49 @@ See the [TypeScript Documentation](./typescript.md) for usage examples.
4143
- Remove custom scripts that set NODE_ENV before running the dev server
4244
- Remove `NODE_ENV=development` from your `bin/dev` or Procfile.dev
4345

46+
## SWC Loose Mode Breaking Change (v9.1.0)
47+
48+
> **⚠️ This breaking change was introduced in v9.1.0.** If you're upgrading from v9.0.0, pay special attention to this section.
49+
50+
**What changed:** SWC default configuration now uses `loose: false` instead of `loose: true`.
51+
52+
**Why:** The previous default of `loose: true` caused:
53+
54+
- **Silent failures with Stimulus controllers** - Controllers wouldn't register properly
55+
- **Incorrect behavior with spread operators** on iterables (e.g., `[...new Set()]`)
56+
- **Deviation from SWC and Babel defaults** - Both tools default to `loose: false`
57+
58+
**Impact:**
59+
60+
- **Most projects:** No action needed. The new default is more correct and fixes bugs.
61+
- **Stimulus users:** This fixes silent controller failures you may have experienced.
62+
- **Projects relying on loose mode behavior:** May need to explicitly configure `loose: true` (not recommended).
63+
64+
**When you might need the old behavior:**
65+
66+
- If you have code that breaks with spec-compliant transforms
67+
- Note: `loose: true` provides slightly faster build times but generates less spec-compliant code
68+
69+
**How to restore old behavior (not recommended):**
70+
71+
Create or update `config/swc.config.js`:
72+
73+
```javascript
74+
module.exports = {
75+
options: {
76+
jsc: {
77+
// Only use this if you have code that requires loose transforms.
78+
// This provides slightly faster build performance but may cause runtime bugs.
79+
loose: true // Restore v9.0.0 behavior
80+
}
81+
}
82+
}
83+
```
84+
85+
**Better solution:** Fix your code to work with spec-compliant transforms. The `loose: false` default aligns with both SWC and Babel standards and prevents subtle bugs.
86+
87+
**Using Stimulus?** The new default includes `keepClassNames: true` to prevent SWC from mangling class names. If you use `rake shakapacker:migrate_to_swc`, this is configured automatically. See [Using SWC with Stimulus](./using_swc_loader.md#using-swc-with-stimulus) for details.
88+
4489
## Breaking Changes
4590

4691
### 1. CSS Modules Configuration Changed to Named Exports

0 commit comments

Comments
 (0)