From df75200cf1132bdc1e1cf84448216cd67374751a Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 5 Oct 2025 14:17:03 -1000 Subject: [PATCH 1/5] Upgrade to Shakapacker 9.0.0.beta.11 and migrate to SWC transpiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- Gemfile.development_dependencies | 2 +- Gemfile.lock | 4 +- spec/dummy/Gemfile.lock | 4 +- spec/dummy/babel.config.js | 34 ----- spec/dummy/config/shakapacker.yml | 80 +++++------ spec/dummy/config/swc.config.js | 13 ++ spec/dummy/package.json | 10 +- spec/dummy/yarn.lock | 232 +++++++++++++----------------- 8 files changed, 154 insertions(+), 225 deletions(-) delete mode 100644 spec/dummy/babel.config.js create mode 100644 spec/dummy/config/swc.config.js diff --git a/Gemfile.development_dependencies b/Gemfile.development_dependencies index e11cd21c92..a276598878 100644 --- a/Gemfile.development_dependencies +++ b/Gemfile.development_dependencies @@ -1,6 +1,6 @@ # frozen_string_literal: true -gem "shakapacker", "8.2.0" +gem "shakapacker", "9.0.0.beta.11" gem "bootsnap", require: false gem "rails", "~> 7.1" diff --git a/Gemfile.lock b/Gemfile.lock index 5fe05932b3..1f15e15b04 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -342,7 +342,7 @@ GEM rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) semantic_range (3.1.0) - shakapacker (8.2.0) + shakapacker (9.0.0.beta.11) activesupport (>= 5.2) package_json rack-proxy (>= 0.6.1) @@ -440,7 +440,7 @@ DEPENDENCIES scss_lint sdoc selenium-webdriver (= 4.9.0) - shakapacker (= 8.2.0) + shakapacker (= 9.0.0.beta.11) spring (~> 4.0) sprockets (~> 4.0) sqlite3 (~> 1.6) diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock index 7641720904..038ce1afc0 100644 --- a/spec/dummy/Gemfile.lock +++ b/spec/dummy/Gemfile.lock @@ -346,7 +346,7 @@ GEM rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) semantic_range (3.1.0) - shakapacker (8.2.0) + shakapacker (9.0.0.beta.11) activesupport (>= 5.2) package_json rack-proxy (>= 0.6.1) @@ -441,7 +441,7 @@ DEPENDENCIES scss_lint sdoc selenium-webdriver (= 4.9.0) - shakapacker (= 8.2.0) + shakapacker (= 9.0.0.beta.11) spring (~> 4.0) sprockets (~> 4.0) sqlite3 (~> 1.6) diff --git a/spec/dummy/babel.config.js b/spec/dummy/babel.config.js deleted file mode 100644 index 6aa1d24be2..0000000000 --- a/spec/dummy/babel.config.js +++ /dev/null @@ -1,34 +0,0 @@ -const defaultConfigFunc = require('shakapacker/package/babel/preset'); - -module.exports = function createBabelConfig(api) { - const resultConfig = defaultConfigFunc(api); - const isProductionEnv = api.env('production'); - const isDevelopmentEnv = api.env('development'); - - const changesOnDefault = { - presets: [ - [ - '@babel/preset-react', - { - development: !isProductionEnv, - runtime: 'automatic', - useBuiltIns: true, - }, - ], - ].filter(Boolean), - plugins: [ - process.env.WEBPACK_SERVE && 'react-refresh/babel', - !isDevelopmentEnv && [ - 'babel-plugin-transform-react-remove-prop-types', - { - removeImport: true, - }, - ], - ].filter(Boolean), - }; - - resultConfig.presets = [...resultConfig.presets, ...changesOnDefault.presets]; - resultConfig.plugins = [...resultConfig.plugins, ...changesOnDefault.plugins]; - - return resultConfig; -}; diff --git a/spec/dummy/config/shakapacker.yml b/spec/dummy/config/shakapacker.yml index c58b284594..96da57047f 100644 --- a/spec/dummy/config/shakapacker.yml +++ b/spec/dummy/config/shakapacker.yml @@ -1,72 +1,66 @@ -# Note: You must restart bin/shakapacker-dev-server for changes to take effect - -default: &default +--- +default: source_path: client/app source_entry_path: packs public_root_path: public - cache_path: tmp/cache/shakapacker webpack_compile_output: false ensure_consistent_versioning: true - - # Additional paths webpack should lookup modules - # ['app/assets', 'engine/foo/app/assets'] - additional_paths: [] - - # Reload manifest.json on all requests so we reload latest compiled packs + additional_paths: &1 [] cache_manifest: false nested_entries: true - + swc: true development: - <<: *default - # Turn this to true if you want to use the rails/shakapacker check that the test - # bundles need building. Also, remove the customization to spec/rails_helper.rb. + source_path: client/app + source_entry_path: packs + public_root_path: public + cache_path: tmp/cache/shakapacker + webpack_compile_output: false + ensure_consistent_versioning: true + additional_paths: *1 + cache_manifest: false + nested_entries: true compile: false - public_output_path: webpack/development - - # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: https: false host: localhost port: 3035 - # Hot Module Replacement updates modules while the application is running without a full reload hmr: true - # Defaults to the inverse of hmr. Uncomment to manually set this. - # live_reload: true client: - # Should we show a full-screen overlay in the browser when there are compiler errors or warnings? overlay: true - # May also be a string - # webSocketURL: - # hostname: "0.0.0.0" - # pathname: "/ws" - # port: 8080 - # Should we use gzip compression? compress: true - # Note that apps that do not check the host are vulnerable to DNS rebinding attacks - allowed_hosts: 'all' + allowed_hosts: all pretty: true headers: - 'Access-Control-Allow-Origin': '*' + Access-Control-Allow-Origin: "*" static: watch: - ignored: '**/node_modules/**' - + ignored: "**/node_modules/**" + swc: true test: - <<: *default + source_path: client/app + source_entry_path: packs + public_root_path: public + cache_path: tmp/cache/shakapacker + webpack_compile_output: false + ensure_consistent_versioning: true + additional_paths: *1 + cache_manifest: false + nested_entries: true compile: false - - # Compile test packs to a separate directory public_output_path: webpack/test - + swc: true production: - <<: *default - + source_path: client/app + source_entry_path: packs + public_root_path: public + cache_path: tmp/cache/shakapacker + webpack_compile_output: false + ensure_consistent_versioning: true + additional_paths: *1 + cache_manifest: true + nested_entries: true public_output_path: webpack/production - - # Production depends on precompilation of packs prior to booting for performance. compile: false - - # Cache manifest.json for performance - cache_manifest: true + swc: true diff --git a/spec/dummy/config/swc.config.js b/spec/dummy/config/swc.config.js new file mode 100644 index 0000000000..520f8353fe --- /dev/null +++ b/spec/dummy/config/swc.config.js @@ -0,0 +1,13 @@ +// config/swc.config.js +// This file is merged with Shakapacker's default SWC configuration +// See: https://swc.rs/docs/configuration/compilation + +module.exports = { + jsc: { + transform: { + react: { + runtime: 'automatic', + }, + }, + }, +}; diff --git a/spec/dummy/package.json b/spec/dummy/package.json index d21f58cf0d..dd08407353 100644 --- a/spec/dummy/package.json +++ b/spec/dummy/package.json @@ -7,7 +7,6 @@ }, "private": true, "dependencies": { - "@babel/runtime": "7.17.9", "@hotwired/turbo-rails": "^8.0.4", "core-js": "3", "create-react-class": "^15.6.3", @@ -30,16 +29,11 @@ }, "devDependencies": { "@babel/core": "7.17.9", - "@babel/plugin-transform-runtime": "7.17.0", - "@babel/preset-env": "7", - "@babel/preset-react": "^7.10.4", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.1", "@rescript/react": "^0.13.0", "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0", "@types/react-helmet": "^6.1.5", - "babel-loader": "8.2.4", - "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "compression-webpack-plugin": "9", "css-loader": "^6.5.1", "expose-loader": "^1.0.3", @@ -59,7 +53,9 @@ "webpack-assets-manifest": "5", "webpack-cli": "4", "webpack-dev-server": "^4.9.0", - "webpack-merge": "5" + "webpack-merge": "5", + "@swc/core": "^1.7.39", + "swc-loader": "^0.2.6" }, "browser": { "fs": false diff --git a/spec/dummy/yarn.lock b/spec/dummy/yarn.lock index a7970829a6..5c5936791f 100644 --- a/spec/dummy/yarn.lock +++ b/spec/dummy/yarn.lock @@ -93,7 +93,7 @@ "@jridgewell/trace-mapping" "^0.3.25" jsesc "^3.0.2" -"@babel/helper-annotate-as-pure@^7.10.4", "@babel/helper-annotate-as-pure@^7.16.7": +"@babel/helper-annotate-as-pure@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" integrity sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw== @@ -108,23 +108,6 @@ "@babel/helper-explode-assignable-expression" "^7.16.7" "@babel/types" "^7.16.7" -"@babel/helper-builder-react-jsx-experimental@^7.10.4", "@babel/helper-builder-react-jsx-experimental@^7.11.5": - version "7.11.5" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx-experimental/-/helper-builder-react-jsx-experimental-7.11.5.tgz#4ea43dd63857b0a35cd1f1b161dc29b43414e79f" - integrity sha512-Vc4aPJnRZKWfzeCBsqTBnzulVNjABVdahSPhtdMD3Vs80ykx4a87jTHtF/VR+alSrDmNvat7l13yrRHauGcHVw== - dependencies: - "@babel/helper-annotate-as-pure" "^7.10.4" - "@babel/helper-module-imports" "^7.10.4" - "@babel/types" "^7.11.5" - -"@babel/helper-builder-react-jsx@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.10.4.tgz#8095cddbff858e6fa9c326daee54a2f2732c1d5d" - integrity sha512-5nPcIZ7+KKDxT1427oBivl9V9YTal7qk0diccnh7RrcgrT/pGFOjgGw1dgryyx1GvHEpXVfoDF6Ak3rTiWh8Rg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.10.4" - "@babel/types" "^7.10.4" - "@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.16.7", "@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.26.5": version "7.27.0" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.0.tgz#de0c753b1cd1d9ab55d473c5a5cf7170f0a81880" @@ -205,7 +188,7 @@ dependencies: "@babel/types" "^7.16.7" -"@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.25.9": +"@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== @@ -522,7 +505,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.10.4", "@babel/plugin-syntax-jsx@^7.7.2": +"@babel/plugin-syntax-jsx@^7.7.2": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz#a34313a178ea56f1951599b929c1ceacee719290" integrity sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA== @@ -777,56 +760,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.16.7" -"@babel/plugin-transform-react-display-name@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.10.4.tgz#b5795f4e3e3140419c3611b7a2a3832b9aef328d" - integrity sha512-Zd4X54Mu9SBfPGnEcaGcOrVAYOtjT2on8QZkLKEq1S/tHexG39d9XXGZv19VfRrDjPJzFmPfTAqOQS1pfFOujw== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-transform-react-jsx-development@^7.10.4": - version "7.11.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.11.5.tgz#e1439e6a57ee3d43e9f54ace363fb29cefe5d7b6" - integrity sha512-cImAmIlKJ84sDmpQzm4/0q/2xrXlDezQoixy3qoz1NJeZL/8PRon6xZtluvr4H4FzwlDGI5tCcFupMnXGtr+qw== - dependencies: - "@babel/helper-builder-react-jsx-experimental" "^7.11.5" - "@babel/helper-plugin-utils" "^7.10.4" - "@babel/plugin-syntax-jsx" "^7.10.4" - -"@babel/plugin-transform-react-jsx-self@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.10.4.tgz#cd301a5fed8988c182ed0b9d55e9bd6db0bd9369" - integrity sha512-yOvxY2pDiVJi0axdTWHSMi5T0DILN+H+SaeJeACHKjQLezEzhLx9nEF9xgpBLPtkZsks9cnb5P9iBEi21En3gg== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - "@babel/plugin-syntax-jsx" "^7.10.4" - -"@babel/plugin-transform-react-jsx-source@^7.10.4": - version "7.10.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.10.5.tgz#34f1779117520a779c054f2cdd9680435b9222b4" - integrity sha512-wTeqHVkN1lfPLubRiZH3o73f4rfon42HpgxUSs86Nc+8QIcm/B9s8NNVXu/gwGcOyd7yDib9ikxoDLxJP0UiDA== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - "@babel/plugin-syntax-jsx" "^7.10.4" - -"@babel/plugin-transform-react-jsx@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.10.4.tgz#673c9f913948764a4421683b2bef2936968fddf2" - integrity sha512-L+MfRhWjX0eI7Js093MM6MacKU4M6dnCRa/QPDwYMxjljzSCzzlzKzj9Pk4P3OtrPcxr2N3znR419nr3Xw+65A== - dependencies: - "@babel/helper-builder-react-jsx" "^7.10.4" - "@babel/helper-builder-react-jsx-experimental" "^7.10.4" - "@babel/helper-plugin-utils" "^7.10.4" - "@babel/plugin-syntax-jsx" "^7.10.4" - -"@babel/plugin-transform-react-pure-annotations@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.10.4.tgz#3eefbb73db94afbc075f097523e445354a1c6501" - integrity sha512-+njZkqcOuS8RaPakrnR9KvxjoG1ASJWpoIv/doyWngId88JoFlPlISenGXjrVacZUIALGUr6eodRs1vmPnF23A== - dependencies: - "@babel/helper-annotate-as-pure" "^7.10.4" - "@babel/helper-plugin-utils" "^7.10.4" - "@babel/plugin-transform-regenerator@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.7.tgz#9e7576dc476cb89ccc5096fff7af659243b4adeb" @@ -841,18 +774,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.16.7" -"@babel/plugin-transform-runtime@7.17.0": - version "7.17.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.17.0.tgz#0a2e08b5e2b2d95c4b1d3b3371a2180617455b70" - integrity sha512-fr7zPWnKXNc1xoHfrIU9mN/4XKX4VLZ45Q+oMhfsYIaHvg7mHgmhfOy/ckRWqDK7XF3QDigRpkh5DKq6+clE8A== - dependencies: - "@babel/helper-module-imports" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - babel-plugin-polyfill-corejs2 "^0.3.0" - babel-plugin-polyfill-corejs3 "^0.5.0" - babel-plugin-polyfill-regenerator "^0.3.0" - semver "^6.3.0" - "@babel/plugin-transform-shorthand-properties@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz#e8549ae4afcf8382f711794c0c7b6b934c5fbd2a" @@ -904,7 +825,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.16.7" "@babel/helper-plugin-utils" "^7.16.7" -"@babel/preset-env@7", "@babel/preset-env@^7.11.0": +"@babel/preset-env@^7.11.0": version "7.16.11" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.16.11.tgz#5dd88fd885fae36f88fd7c8342475c9f0abe2982" integrity sha512-qcmWG8R7ZW6WBRPZK//y+E3Cli151B20W1Rv7ln27vuPaXU/8TKms6jFdiJtF7UDTxcrb7mZd88tAeK9LjdT8g== @@ -995,20 +916,7 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-react@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.10.4.tgz#92e8a66d816f9911d11d4cc935be67adfc82dbcf" - integrity sha512-BrHp4TgOIy4M19JAfO1LhycVXOPWdDbTRep7eVyatf174Hff+6Uk53sDyajqZPu8W1qXRBiYOfIamek6jA7YVw== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - "@babel/plugin-transform-react-display-name" "^7.10.4" - "@babel/plugin-transform-react-jsx" "^7.10.4" - "@babel/plugin-transform-react-jsx-development" "^7.10.4" - "@babel/plugin-transform-react-jsx-self" "^7.10.4" - "@babel/plugin-transform-react-jsx-source" "^7.10.4" - "@babel/plugin-transform-react-pure-annotations" "^7.10.4" - -"@babel/runtime@7.17.9", "@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.8.4": version "7.17.9" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.9.tgz#d19fbf802d01a8cb6cf053a64e472d42c434ba72" integrity sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg== @@ -1037,7 +945,7 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.5", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.25.9", "@babel/types@^7.26.10", "@babel/types@^7.27.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": +"@babel/types@^7.0.0", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.25.9", "@babel/types@^7.26.10", "@babel/types@^7.27.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": version "7.27.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.0.tgz#ef9acb6b06c3173f6632d993ecb6d4ae470b4559" integrity sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg== @@ -1357,6 +1265,87 @@ dependencies: "@sinonjs/commons" "^3.0.0" +"@swc/core-darwin-arm64@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.13.5.tgz#7638c073946f9297753ed9a2eb198d07b2336a24" + integrity sha512-lKNv7SujeXvKn16gvQqUQI5DdyY8v7xcoO3k06/FJbHJS90zEwZdQiMNRiqpYw/orU543tPaWgz7cIYWhbopiQ== + +"@swc/core-darwin-x64@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.13.5.tgz#18061167378f0fb285e17818494bc6c89dd07551" + integrity sha512-ILd38Fg/w23vHb0yVjlWvQBoE37ZJTdlLHa8LRCFDdX4WKfnVBiblsCU9ar4QTMNdeTBEX9iUF4IrbNWhaF1Ng== + +"@swc/core-linux-arm-gnueabihf@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.13.5.tgz#4c8062bd598049b5b9b0beb762e075e76b4c23c3" + integrity sha512-Q6eS3Pt8GLkXxqz9TAw+AUk9HpVJt8Uzm54MvPsqp2yuGmY0/sNaPPNVqctCX9fu/Nu8eaWUen0si6iEiCsazQ== + +"@swc/core-linux-arm64-gnu@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.13.5.tgz#7222d321197ea9304e387933e87d775849fc1ae6" + integrity sha512-aNDfeN+9af+y+M2MYfxCzCy/VDq7Z5YIbMqRI739o8Ganz6ST+27kjQFd8Y/57JN/hcnUEa9xqdS3XY7WaVtSw== + +"@swc/core-linux-arm64-musl@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.13.5.tgz#51e7958deaf37edc212bd9dc0ea1476f151d2bea" + integrity sha512-9+ZxFN5GJag4CnYnq6apKTnnezpfJhCumyz0504/JbHLo+Ue+ZtJnf3RhyA9W9TINtLE0bC4hKpWi8ZKoETyOQ== + +"@swc/core-linux-x64-gnu@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.13.5.tgz#3476beab93ab03e92844d955ca9d9289aa4a5993" + integrity sha512-WD530qvHrki8Ywt/PloKUjaRKgstQqNGvmZl54g06kA+hqtSE2FTG9gngXr3UJxYu/cNAjJYiBifm7+w4nbHbA== + +"@swc/core-linux-x64-musl@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.13.5.tgz#f4934b1e77e2a297909bb3ab977836205c36e5e0" + integrity sha512-Luj8y4OFYx4DHNQTWjdIuKTq2f5k6uSXICqx+FSabnXptaOBAbJHNbHT/06JZh6NRUouaf0mYXN0mcsqvkhd7Q== + +"@swc/core-win32-arm64-msvc@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.13.5.tgz#5084c107435cfc82d4d901bfb388dc319d38a236" + integrity sha512-cZ6UpumhF9SDJvv4DA2fo9WIzlNFuKSkZpZmPG1c+4PFSEMy5DFOjBSllCvnqihCabzXzpn6ykCwBmHpy31vQw== + +"@swc/core-win32-ia32-msvc@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.13.5.tgz#f8b2e28bc51b30467e316ed736a130c1324b9880" + integrity sha512-C5Yi/xIikrFUzZcyGj9L3RpKljFvKiDMtyDzPKzlsDrKIw2EYY+bF88gB6oGY5RGmv4DAX8dbnpRAqgFD0FMEw== + +"@swc/core-win32-x64-msvc@1.13.5": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.13.5.tgz#13883cf3c63bf11b787e28dcdf75ca0cc49efa83" + integrity sha512-YrKdMVxbYmlfybCSbRtrilc6UA8GF5aPmGKBdPvjrarvsmf4i7ZHGCEnLtfOMd3Lwbs2WUZq3WdMbozYeLU93Q== + +"@swc/core@^1.7.39": + version "1.13.5" + resolved "https://registry.npmjs.org/@swc/core/-/core-1.13.5.tgz#93874b831d3bd121560e6fcd688972b7fc7baa26" + integrity sha512-WezcBo8a0Dg2rnR82zhwoR6aRNxeTGfK5QCD6TQ+kg3xx/zNT02s/0o+81h/3zhvFSB24NtqEr8FTw88O5W/JQ== + dependencies: + "@swc/counter" "^0.1.3" + "@swc/types" "^0.1.24" + optionalDependencies: + "@swc/core-darwin-arm64" "1.13.5" + "@swc/core-darwin-x64" "1.13.5" + "@swc/core-linux-arm-gnueabihf" "1.13.5" + "@swc/core-linux-arm64-gnu" "1.13.5" + "@swc/core-linux-arm64-musl" "1.13.5" + "@swc/core-linux-x64-gnu" "1.13.5" + "@swc/core-linux-x64-musl" "1.13.5" + "@swc/core-win32-arm64-msvc" "1.13.5" + "@swc/core-win32-ia32-msvc" "1.13.5" + "@swc/core-win32-x64-msvc" "1.13.5" + +"@swc/counter@^0.1.3": + version "0.1.3" + resolved "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9" + integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== + +"@swc/types@^0.1.24": + version "0.1.25" + resolved "https://registry.npmjs.org/@swc/types/-/types-0.1.25.tgz#b517b2a60feb37dd933e542d93093719e4cf1078" + integrity sha512-iAoY/qRhNH8a/hBvm3zKj9qQ4oc2+3w1unPJa2XvTK3XjeLXtzcCingVPw/9e5mn1+0yPqxcBGp9Jf0pkfMb1g== + dependencies: + "@swc/counter" "^0.1.3" + "@types/babel__core@^7.1.14": version "7.20.5" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -1960,16 +1949,6 @@ babel-jest@^29.7.0: graceful-fs "^4.2.9" slash "^3.0.0" -babel-loader@8.2.4: - version "8.2.4" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.4.tgz#95f5023c791b2e9e2ca6f67b0984f39c82ff384b" - integrity sha512-8dytA3gcvPPPv4Grjhnt8b5IIiTcq/zeXOPk4iTYI0SVXcsmuGg7JtBRDp8S9X+gJfhQ8ektjXZlDu1Bb33U8A== - dependencies: - find-cache-dir "^3.3.1" - loader-utils "^2.0.0" - make-dir "^3.1.0" - schema-utils "^2.6.5" - babel-plugin-dynamic-import-node@^2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3" @@ -2022,11 +2001,6 @@ babel-plugin-polyfill-regenerator@^0.3.0: dependencies: "@babel/helper-define-polyfill-provider" "^0.3.1" -babel-plugin-transform-react-remove-prop-types@^0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz#f2edaf9b4c6a5fbe5c1d678bfb531078c1555f3a" - integrity sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA== - babel-preset-current-node-syntax@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" @@ -2481,11 +2455,6 @@ common-path-prefix@^3.0.0: resolved "https://registry.yarnpkg.com/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" integrity sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w== -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= - component-emitter@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" @@ -3206,15 +3175,6 @@ finalhandler@1.2.0: statuses "2.0.1" unpipe "~1.0.0" -find-cache-dir@^3.3.1: - version "3.3.2" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.2.tgz#b30c5b6eff0730731aea9bbd9dbecbd80256d64b" - integrity sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig== - dependencies: - commondir "^1.0.1" - make-dir "^3.0.2" - pkg-dir "^4.1.0" - find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" @@ -4442,13 +4402,6 @@ make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" -make-dir@^3.0.2, make-dir@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" - integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== - dependencies: - semver "^6.0.0" - make-dir@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" @@ -4997,7 +4950,7 @@ pirates@^4.0.4: resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== -pkg-dir@^4.1.0, pkg-dir@^4.2.0: +pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== @@ -5602,7 +5555,7 @@ semver@^5.6.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0, semver@^6.3.1: +semver@^6.1.1, semver@^6.1.2, semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== @@ -6007,6 +5960,13 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +swc-loader@^0.2.6: + version "0.2.6" + resolved "https://registry.npmjs.org/swc-loader/-/swc-loader-0.2.6.tgz#bf0cba8eeff34bb19620ead81d1277fefaec6bc8" + integrity sha512-9Zi9UP2YmDpgmQVbyOPJClY0dwf58JDyDMQ7uRc4krmc72twNI2fvlBWHLqVekBpPc7h5NJkGVT1zNDxFrqhvg== + dependencies: + "@swc/counter" "^0.1.3" + symbol-observable@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" From c42aeedd6a88b702c0e4917d59814924a6377f13 Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 5 Oct 2025 20:35:46 -1000 Subject: [PATCH 2/5] Update shakapacker version in package.json to 9.0.0.beta.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update spec/dummy/package.json shakapacker dependency from 8.2.0 to 9.0.0.beta.11 - This matches the Gemfile update in the previous commit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- spec/dummy/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/dummy/package.json b/spec/dummy/package.json index dd08407353..b7209b7963 100644 --- a/spec/dummy/package.json +++ b/spec/dummy/package.json @@ -45,7 +45,7 @@ "sass": "^1.43.4", "sass-loader": "^12.3.0", "sass-resources-loader": "^2.1.0", - "shakapacker": "8.2.0", + "shakapacker": "9.0.0.beta.11", "style-loader": "^3.3.1", "terser-webpack-plugin": "5.3.1", "url-loader": "^4.0.0", From 8293b1310432528f3885bf1e1e4e9a806c3b4a33 Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 5 Oct 2025 20:58:57 -1000 Subject: [PATCH 3/5] Complete Babel cleanup and add React Refresh to SWC config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove @babel/core direct dependency (still used by Jest, which is fine) - Add React Refresh configuration to swc.config.js: - Enable development mode in development environment - Enable Fast Refresh for hot module replacement - This ensures React Fast Refresh works properly with SWC 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- spec/dummy/config/swc.config.js | 2 ++ spec/dummy/package.json | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/dummy/config/swc.config.js b/spec/dummy/config/swc.config.js index 520f8353fe..bd90be2372 100644 --- a/spec/dummy/config/swc.config.js +++ b/spec/dummy/config/swc.config.js @@ -7,6 +7,8 @@ module.exports = { transform: { react: { runtime: 'automatic', + development: process.env.NODE_ENV === 'development', + refresh: process.env.NODE_ENV === 'development', // Enable Fast Refresh in development }, }, }, diff --git a/spec/dummy/package.json b/spec/dummy/package.json index b7209b7963..5b4088c09c 100644 --- a/spec/dummy/package.json +++ b/spec/dummy/package.json @@ -28,7 +28,6 @@ "regenerator-runtime": "^0.13.4" }, "devDependencies": { - "@babel/core": "7.17.9", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.1", "@rescript/react": "^0.13.0", "@types/react": "^19.0.0", From 603f0e52b233ec70c66bcb0588739a61d9d7c424 Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 5 Oct 2025 21:06:09 -1000 Subject: [PATCH 4/5] Restore helpful comments to shakapacker.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Restore all useful comments explaining configuration options - Use YAML anchor syntax (&default, <<: *default) for cleaner inheritance - Add comment explaining SWC transpiler usage - Improves developer experience and maintainability The migration task had removed these comments, but they provide valuable context for developers working with the configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- spec/dummy/config/shakapacker.yml | 74 +++++++++++++++++-------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/spec/dummy/config/shakapacker.yml b/spec/dummy/config/shakapacker.yml index 96da57047f..dd4d03fc1a 100644 --- a/spec/dummy/config/shakapacker.yml +++ b/spec/dummy/config/shakapacker.yml @@ -1,35 +1,52 @@ ---- -default: +# Note: You must restart bin/shakapacker-dev-server for changes to take effect + +default: &default source_path: client/app source_entry_path: packs public_root_path: public cache_path: tmp/cache/shakapacker webpack_compile_output: false ensure_consistent_versioning: true - additional_paths: &1 [] + + # Additional paths webpack should lookup modules + # ['app/assets', 'engine/foo/app/assets'] + additional_paths: [] + + # Reload manifest.json on all requests so we reload latest compiled packs cache_manifest: false nested_entries: true + + # Use SWC instead of Babel for transpilation (~20x faster) swc: true + development: - source_path: client/app - source_entry_path: packs - public_root_path: public - cache_path: tmp/cache/shakapacker - webpack_compile_output: false - ensure_consistent_versioning: true - additional_paths: *1 - cache_manifest: false - nested_entries: true + <<: *default + # Turn this to true if you want to use the rails/shakapacker check that the test + # bundles need building. Also, remove the customization to spec/rails_helper.rb. compile: false + public_output_path: webpack/development + + # Reference: https://webpack.js.org/configuration/dev-server/ dev_server: https: false host: localhost port: 3035 + # Hot Module Replacement updates modules while the application is running without a full reload hmr: true + # Defaults to the inverse of hmr. Uncomment to manually set this. + # live_reload: true client: + # Should we show a full-screen overlay in the browser when there are compiler errors or warnings? overlay: true + # May also be a string + # webSocketURL: + # hostname: "0.0.0.0" + # pathname: "/ws" + # port: 8080 + # Should we use gzip compression? compress: true + # Note that apps that do not check the host are vulnerable to DNS rebinding attacks allowed_hosts: all pretty: true headers: @@ -37,30 +54,21 @@ development: static: watch: ignored: "**/node_modules/**" - swc: true + test: - source_path: client/app - source_entry_path: packs - public_root_path: public - cache_path: tmp/cache/shakapacker - webpack_compile_output: false - ensure_consistent_versioning: true - additional_paths: *1 - cache_manifest: false - nested_entries: true + <<: *default compile: false + + # Compile test packs to a separate directory public_output_path: webpack/test - swc: true + production: - source_path: client/app - source_entry_path: packs - public_root_path: public - cache_path: tmp/cache/shakapacker - webpack_compile_output: false - ensure_consistent_versioning: true - additional_paths: *1 - cache_manifest: true - nested_entries: true + <<: *default + public_output_path: webpack/production + + # Production depends on precompilation of packs prior to booting for performance. compile: false - swc: true + + # Cache manifest.json for performance + cache_manifest: true From 7a23d8c9adacb3190f51f590a76ab1c5c8b66b00 Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 5 Oct 2025 21:08:15 -1000 Subject: [PATCH 5/5] Fix React Refresh to only enable with webpack-dev-server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change refresh condition from NODE_ENV === 'development' to WEBPACK_SERVE - This ensures Fast Refresh only activates when using webpack-dev-server (bin/dev) - Avoids unnecessary Fast Refresh transformation for static builds (bin/shakapacker) - Matches the behavior of ReactRefreshWebpackPlugin in development.js The WEBPACK_SERVE environment variable is set by webpack-dev-server and is the correct indicator for when HMR and Fast Refresh should be active. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- spec/dummy/config/swc.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/dummy/config/swc.config.js b/spec/dummy/config/swc.config.js index bd90be2372..4582eaddf4 100644 --- a/spec/dummy/config/swc.config.js +++ b/spec/dummy/config/swc.config.js @@ -8,7 +8,9 @@ module.exports = { react: { runtime: 'automatic', development: process.env.NODE_ENV === 'development', - refresh: process.env.NODE_ENV === 'development', // Enable Fast Refresh in development + // Only enable Fast Refresh when using webpack-dev-server (bin/dev) + // Not needed for static builds (bin/shakapacker) + refresh: !!process.env.WEBPACK_SERVE, }, }, },