Skip to content

Commit ab239e0

Browse files
justin808claude
andcommitted
Upgrade to Shakapacker 9.0.0.beta.11 and migrate to SWC transpiler
- Update shakapacker from 8.2.0 to 9.0.0.beta.11 - Migrate from Babel to SWC transpiler for ~20x faster transpilation - Remove Babel-related packages and configuration - Add SWC dependencies (@swc/core, swc-loader) - Configure SWC in shakapacker.yml for all environments - Add config/swc.config.js for custom SWC configuration - Remove babel.config.js as it's no longer needed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c3ad7a9 commit ab239e0

File tree

8 files changed

+154
-225
lines changed

8 files changed

+154
-225
lines changed

Gemfile.development_dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
gem "shakapacker", "8.2.0"
3+
gem "shakapacker", "9.0.0.beta.11"
44
gem "bootsnap", require: false
55
gem "rails", "~> 7.1"
66

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ GEM
342342
rubyzip (>= 1.2.2, < 3.0)
343343
websocket (~> 1.0)
344344
semantic_range (3.1.0)
345-
shakapacker (8.2.0)
345+
shakapacker (9.0.0.beta.11)
346346
activesupport (>= 5.2)
347347
package_json
348348
rack-proxy (>= 0.6.1)
@@ -440,7 +440,7 @@ DEPENDENCIES
440440
scss_lint
441441
sdoc
442442
selenium-webdriver (= 4.9.0)
443-
shakapacker (= 8.2.0)
443+
shakapacker (= 9.0.0.beta.11)
444444
spring (~> 4.0)
445445
sprockets (~> 4.0)
446446
sqlite3 (~> 1.6)

spec/dummy/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ GEM
346346
rubyzip (>= 1.2.2, < 3.0)
347347
websocket (~> 1.0)
348348
semantic_range (3.1.0)
349-
shakapacker (8.2.0)
349+
shakapacker (9.0.0.beta.11)
350350
activesupport (>= 5.2)
351351
package_json
352352
rack-proxy (>= 0.6.1)
@@ -441,7 +441,7 @@ DEPENDENCIES
441441
scss_lint
442442
sdoc
443443
selenium-webdriver (= 4.9.0)
444-
shakapacker (= 8.2.0)
444+
shakapacker (= 9.0.0.beta.11)
445445
spring (~> 4.0)
446446
sprockets (~> 4.0)
447447
sqlite3 (~> 1.6)

spec/dummy/babel.config.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

spec/dummy/config/shakapacker.yml

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,66 @@
1-
# Note: You must restart bin/shakapacker-dev-server for changes to take effect
2-
3-
default: &default
1+
---
2+
default:
43
source_path: client/app
54
source_entry_path: packs
65
public_root_path: public
7-
86
cache_path: tmp/cache/shakapacker
97
webpack_compile_output: false
108
ensure_consistent_versioning: true
11-
12-
# Additional paths webpack should lookup modules
13-
# ['app/assets', 'engine/foo/app/assets']
14-
additional_paths: []
15-
16-
# Reload manifest.json on all requests so we reload latest compiled packs
9+
additional_paths: &1 []
1710
cache_manifest: false
1811
nested_entries: true
19-
12+
swc: true
2013
development:
21-
<<: *default
22-
# Turn this to true if you want to use the rails/shakapacker check that the test
23-
# bundles need building. Also, remove the customization to spec/rails_helper.rb.
14+
source_path: client/app
15+
source_entry_path: packs
16+
public_root_path: public
17+
cache_path: tmp/cache/shakapacker
18+
webpack_compile_output: false
19+
ensure_consistent_versioning: true
20+
additional_paths: *1
21+
cache_manifest: false
22+
nested_entries: true
2423
compile: false
25-
2624
public_output_path: webpack/development
27-
28-
# Reference: https://webpack.js.org/configuration/dev-server/
2925
dev_server:
3026
https: false
3127
host: localhost
3228
port: 3035
33-
# Hot Module Replacement updates modules while the application is running without a full reload
3429
hmr: true
35-
# Defaults to the inverse of hmr. Uncomment to manually set this.
36-
# live_reload: true
3730
client:
38-
# Should we show a full-screen overlay in the browser when there are compiler errors or warnings?
3931
overlay: true
40-
# May also be a string
41-
# webSocketURL:
42-
# hostname: "0.0.0.0"
43-
# pathname: "/ws"
44-
# port: 8080
45-
# Should we use gzip compression?
4632
compress: true
47-
# Note that apps that do not check the host are vulnerable to DNS rebinding attacks
48-
allowed_hosts: 'all'
33+
allowed_hosts: all
4934
pretty: true
5035
headers:
51-
'Access-Control-Allow-Origin': '*'
36+
Access-Control-Allow-Origin: "*"
5237
static:
5338
watch:
54-
ignored: '**/node_modules/**'
55-
39+
ignored: "**/node_modules/**"
40+
swc: true
5641
test:
57-
<<: *default
42+
source_path: client/app
43+
source_entry_path: packs
44+
public_root_path: public
45+
cache_path: tmp/cache/shakapacker
46+
webpack_compile_output: false
47+
ensure_consistent_versioning: true
48+
additional_paths: *1
49+
cache_manifest: false
50+
nested_entries: true
5851
compile: false
59-
60-
# Compile test packs to a separate directory
6152
public_output_path: webpack/test
62-
53+
swc: true
6354
production:
64-
<<: *default
65-
55+
source_path: client/app
56+
source_entry_path: packs
57+
public_root_path: public
58+
cache_path: tmp/cache/shakapacker
59+
webpack_compile_output: false
60+
ensure_consistent_versioning: true
61+
additional_paths: *1
62+
cache_manifest: true
63+
nested_entries: true
6664
public_output_path: webpack/production
67-
68-
# Production depends on precompilation of packs prior to booting for performance.
6965
compile: false
70-
71-
# Cache manifest.json for performance
72-
cache_manifest: true
66+
swc: true

spec/dummy/config/swc.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// config/swc.config.js
2+
// This file is merged with Shakapacker's default SWC configuration
3+
// See: https://swc.rs/docs/configuration/compilation
4+
5+
module.exports = {
6+
jsc: {
7+
transform: {
8+
react: {
9+
runtime: 'automatic',
10+
},
11+
},
12+
},
13+
};

spec/dummy/package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
},
88
"private": true,
99
"dependencies": {
10-
"@babel/runtime": "7.17.9",
1110
"@hotwired/turbo-rails": "^8.0.4",
1211
"core-js": "3",
1312
"create-react-class": "^15.6.3",
@@ -30,16 +29,11 @@
3029
},
3130
"devDependencies": {
3231
"@babel/core": "7.17.9",
33-
"@babel/plugin-transform-runtime": "7.17.0",
34-
"@babel/preset-env": "7",
35-
"@babel/preset-react": "^7.10.4",
3632
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
3733
"@rescript/react": "^0.13.0",
3834
"@types/react": "^19.0.0",
3935
"@types/react-dom": "^19.0.0",
4036
"@types/react-helmet": "^6.1.5",
41-
"babel-loader": "8.2.4",
42-
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
4337
"compression-webpack-plugin": "9",
4438
"css-loader": "^6.5.1",
4539
"expose-loader": "^1.0.3",
@@ -59,7 +53,9 @@
5953
"webpack-assets-manifest": "5",
6054
"webpack-cli": "4",
6155
"webpack-dev-server": "^4.9.0",
62-
"webpack-merge": "5"
56+
"webpack-merge": "5",
57+
"@swc/core": "^1.7.39",
58+
"swc-loader": "^0.2.6"
6359
},
6460
"browser": {
6561
"fs": false

0 commit comments

Comments
 (0)