|
| 1 | +# Shakapacker 9.0.0-beta.5 Missing Compiled JavaScript Files |
| 2 | + |
| 3 | +## Issue Summary |
| 4 | +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. |
| 5 | + |
| 6 | +## Details |
| 7 | + |
| 8 | +### What's happening: |
| 9 | +When trying to use shakapacker 9.0.0-beta.5, webpack fails with: |
| 10 | +``` |
| 11 | +Error: Cannot find module '/path/to/node_modules/shakapacker/package/index.js' |
| 12 | +``` |
| 13 | + |
| 14 | +### Root Cause: |
| 15 | +The npm package contains only TypeScript source files without the compiled JavaScript output. |
| 16 | + |
| 17 | +### Investigation Results: |
| 18 | + |
| 19 | +**Beta.4 package structure (working):** |
| 20 | +```bash |
| 21 | +$ ls -la node_modules/shakapacker/package/ |
| 22 | +-rw-r--r-- config.js # ✅ JavaScript file exists |
| 23 | +-rw-r--r-- dev_server.js # ✅ JavaScript file exists |
| 24 | +-rw-r--r-- env.js # ✅ JavaScript file exists |
| 25 | +-rw-r--r-- index.js # ✅ JavaScript file exists |
| 26 | +-rw-r--r-- index.d.ts # TypeScript definitions |
| 27 | +``` |
| 28 | + |
| 29 | +**Beta.5 package structure (broken):** |
| 30 | +```bash |
| 31 | +$ ls -la node_modules/shakapacker/package/ |
| 32 | +-rw-r--r-- config.ts # ❌ TypeScript source only |
| 33 | +-rw-r--r-- dev_server.ts # ❌ TypeScript source only |
| 34 | +-rw-r--r-- env.ts # ❌ TypeScript source only |
| 35 | +-rw-r--r-- index.ts # ❌ TypeScript source only |
| 36 | +-rw-r--r-- index.d.ts # TypeScript definitions |
| 37 | +# Missing: index.js, config.js, dev_server.js, env.js |
| 38 | +``` |
| 39 | + |
| 40 | +### Package.json has build script: |
| 41 | +```json |
| 42 | +{ |
| 43 | + "scripts": { |
| 44 | + "build": "tsc", |
| 45 | + // ... |
| 46 | + } |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +But the tsconfig.json is not included in the published package, and the build output is missing. |
| 51 | + |
| 52 | +## Likely Fix Needed |
| 53 | + |
| 54 | +The build process needs to: |
| 55 | +1. Run `npm run build` before publishing to compile TypeScript to JavaScript |
| 56 | +2. Ensure the compiled .js files are included in the npm package |
| 57 | +3. Update the package.json "files" field or .npmignore to include the compiled output |
| 58 | + |
| 59 | +## Workaround |
| 60 | + |
| 61 | +For now, users should use: |
| 62 | +- **9.0.0-beta.4** which has the compiled JavaScript files |
| 63 | +- Set `javascript_transpiler: babel` in shakapacker.yml (beta.4 defaults to SWC) |
| 64 | + |
| 65 | +## Version Comparison |
| 66 | + |
| 67 | +| Version | Status | Notes | |
| 68 | +|---------|--------|-------| |
| 69 | +| 8.2.0 | ✅ Working | Stable release | |
| 70 | +| 8.4.0 | ✅ Working | Latest stable | |
| 71 | +| 9.0.0-beta.4 | ✅ Working | Has compiled JS, defaults to SWC | |
| 72 | +| 9.0.0-beta.5 | ❌ Broken | Missing compiled JS files | |
| 73 | + |
| 74 | +## Configuration Change for Beta.4 |
| 75 | + |
| 76 | +When using beta.4, add to `config/shakapacker.yml`: |
| 77 | +```yaml |
| 78 | +default: &default |
| 79 | + javascript_transpiler: babel # Beta versions default to SWC |
| 80 | +``` |
0 commit comments