Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Do not upgrade to beta.5—it ships without compiled JS output.

Line 9 pulls in shakapacker 9.0.0.beta.5, but the investigation doc in this PR shows that beta.5 is published without any compiled .js files, so webpack fails with “Cannot find module ‘…/shakapacker/package/index.js’.” Shipping this version will break every build. Please stick to 9.0.0-beta.4 (or 8.x) until beta.5 is republished with the compiled output.

Apply this diff to keep the project working:

-gem "shakapacker", "9.0.0.beta.5"
+gem "shakapacker", "9.0.0.beta.4"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
gem "shakapacker", "9.0.0.beta.5"
gem "shakapacker", "9.0.0.beta.4"
🤖 Prompt for AI Agents
In Gemfile around line 9, the project currently specifies gem "shakapacker",
"9.0.0.beta.5" which is a broken release missing compiled JS; change the Gemfile
to pin a safe version (e.g. "9.0.0-beta.4" or an 8.x release) by replacing the
version string on that line with the chosen stable version and run bundle
install to update Gemfile.lock.


# Bundle edge Rails instead: gem "rails", github: "rails/rails"
gem "listen"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
80 changes: 80 additions & 0 deletions SHAKAPACKER_BETA5_ISSUE.md
Original file line number Diff line number Diff line change
@@ -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
```
1 change: 1 addition & 0 deletions config/shakapacker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Keep npm on beta.4 until beta.5 is republished with JS builds.

Line 96 updates npm to shakapacker@9.0.0-beta.5, but that package is missing all compiled JavaScript files, so require('shakapacker') blows up at runtime. This mirrors the failure documented in SHAKAPACKER_BETA5_ISSUE.md. Please revert to beta.4 (or another working release) until beta.5 includes its build artifacts.

-    "shakapacker": "9.0.0-beta.5",
+    "shakapacker": "9.0.0-beta.4",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"shakapacker": "9.0.0-beta.5",
"shakapacker": "9.0.0-beta.4",
🤖 Prompt for AI Agents
In package.json around line 96, the dependency was upgraded to "shakapacker":
"9.0.0-beta.5" but that release is missing compiled JS and breaks
require('shakapacker'); change the version back to a known-good release (e.g.
"9.0.0-beta.4" or another working tag), then update the lockfile and reinstall
dependencies (npm install or npm ci) and run the test/start script to verify the
runtime no longer fails; once beta.5 includes builds you can bump the version
and repeat verification.

"stimulus": "^3.0.1",
"style-loader": "^3.3.1",
"tailwindcss": "^3.3.3",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading