diff --git a/Gemfile b/Gemfile index 77b86575..a041e435 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "3.3.4" gem "react_on_rails", "16.1.1" -gem "shakapacker", "8.2.0" +gem "shakapacker", "9.0.0.beta.5" # Bundle edge Rails instead: gem "rails", github: "rails/rails" gem "listen" diff --git a/Gemfile.lock b/Gemfile.lock index b0cddd1d..13a035f7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -390,7 +390,7 @@ GEM websocket (~> 1.0) semantic_range (3.1.0) sexp_processor (4.17.1) - shakapacker (8.2.0) + shakapacker (9.0.0.beta.5) activesupport (>= 5.2) package_json rack-proxy (>= 0.6.1) @@ -499,7 +499,7 @@ DEPENDENCIES scss_lint sdoc selenium-webdriver (~> 4) - shakapacker (= 8.2.0) + shakapacker (= 9.0.0.beta.5) spring spring-commands-rspec stimulus-rails (~> 1.3) diff --git a/SHAKAPACKER_BETA5_ISSUE.md b/SHAKAPACKER_BETA5_ISSUE.md new file mode 100644 index 00000000..2689f2e4 --- /dev/null +++ b/SHAKAPACKER_BETA5_ISSUE.md @@ -0,0 +1,80 @@ +# Shakapacker 9.0.0-beta.5 Missing Compiled JavaScript Files + +## Issue Summary +Shakapacker 9.0.0-beta.5 npm package is published with TypeScript source files (.ts) but missing the compiled JavaScript files (.js), making the package unusable. + +## Details + +### What's happening: +When trying to use shakapacker 9.0.0-beta.5, webpack fails with: +``` +Error: Cannot find module '/path/to/node_modules/shakapacker/package/index.js' +``` + +### Root Cause: +The npm package contains only TypeScript source files without the compiled JavaScript output. + +### Investigation Results: + +**Beta.4 package structure (working):** +```bash +$ ls -la node_modules/shakapacker/package/ +-rw-r--r-- config.js # ✅ JavaScript file exists +-rw-r--r-- dev_server.js # ✅ JavaScript file exists +-rw-r--r-- env.js # ✅ JavaScript file exists +-rw-r--r-- index.js # ✅ JavaScript file exists +-rw-r--r-- index.d.ts # TypeScript definitions +``` + +**Beta.5 package structure (broken):** +```bash +$ ls -la node_modules/shakapacker/package/ +-rw-r--r-- config.ts # ❌ TypeScript source only +-rw-r--r-- dev_server.ts # ❌ TypeScript source only +-rw-r--r-- env.ts # ❌ TypeScript source only +-rw-r--r-- index.ts # ❌ TypeScript source only +-rw-r--r-- index.d.ts # TypeScript definitions +# Missing: index.js, config.js, dev_server.js, env.js +``` + +### Package.json has build script: +```json +{ + "scripts": { + "build": "tsc", + // ... + } +} +``` + +But the tsconfig.json is not included in the published package, and the build output is missing. + +## Likely Fix Needed + +The build process needs to: +1. Run `npm run build` before publishing to compile TypeScript to JavaScript +2. Ensure the compiled .js files are included in the npm package +3. Update the package.json "files" field or .npmignore to include the compiled output + +## Workaround + +For now, users should use: +- **9.0.0-beta.4** which has the compiled JavaScript files +- Set `javascript_transpiler: babel` in shakapacker.yml (beta.4 defaults to SWC) + +## Version Comparison + +| Version | Status | Notes | +|---------|--------|-------| +| 8.2.0 | ✅ Working | Stable release | +| 8.4.0 | ✅ Working | Latest stable | +| 9.0.0-beta.4 | ✅ Working | Has compiled JS, defaults to SWC | +| 9.0.0-beta.5 | ❌ Broken | Missing compiled JS files | + +## Configuration Change for Beta.4 + +When using beta.4, add to `config/shakapacker.yml`: +```yaml +default: &default + javascript_transpiler: babel # Beta versions default to SWC +``` \ No newline at end of file diff --git a/config/shakapacker.yml b/config/shakapacker.yml index ebc5e4c5..a4d453f2 100644 --- a/config/shakapacker.yml +++ b/config/shakapacker.yml @@ -8,6 +8,7 @@ default: &default cache_path: tmp/shakapacker webpack_compile_output: true nested_entries: true + javascript_transpiler: babel # Additional paths webpack should lookup modules # ['app/assets', 'engine/foo/app/assets'] diff --git a/package.json b/package.json index afa73247..7ba7194d 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "sass": "^1.58.3", "sass-loader": "^13.3.2", "sass-resources-loader": "^2.2.5", - "shakapacker": "8.2.0", + "shakapacker": "9.0.0-beta.5", "stimulus": "^3.0.1", "style-loader": "^3.3.1", "tailwindcss": "^3.3.3", diff --git a/yarn.lock b/yarn.lock index 0189edd8..1fafbc16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8263,10 +8263,10 @@ setprototypeof@1.2.0: resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== -shakapacker@8.2.0: - version "8.2.0" - resolved "https://registry.npmjs.org/shakapacker/-/shakapacker-8.2.0.tgz#c7bed87b8be2ae565cfe616f68552be545c77e14" - integrity sha512-Ct7BFqJVnKbxdqCzG+ja7Q6LPt/PlB7sSVBfG5jsAvmVCADM05cuoNwEgYNjFGKbDzHAxUqy5XgoI9Y030+JKQ== +shakapacker@9.0.0-beta.5: + version "9.0.0-beta.5" + resolved "https://registry.npmjs.org/shakapacker/-/shakapacker-9.0.0-beta.5.tgz#1fa7c9641f89f3abcad507f4c077508730da1ece" + integrity sha512-L0jEx1yFUxlpUcygceQFMFl7qYjgk4OB453KnKFa8EqJ5zjmDXTkHUDjMuzGQDT+l/oHeaX5jAg2HpkvM5P93A== dependencies: js-yaml "^4.1.0" path-complete-extname "^1.0.0"