Bug Report
Package: opencode-qwencode-auth@1.3.0 (npm)
Affected: All OpenCode installations loading this plugin via npm
Severity: High — plugin completely non-functional
Problem
The published npm package contains only TypeScript source files (.ts), but OpenCode's ESM plugin loader resolves imports with .js extensions. This causes the plugin to fail on load with ENOENT.
Reproduction
# Install plugin
cd ~/.opencode && npm install opencode-qwencode-auth@1.3.0
# Enable in config
echo '{"plugin": ["opencode-qwencode-auth"]}' > ~/.config/opencode/opencode.json
# Try to use
opencode auth login
Expected: Qwen Code appears in provider list
Actual: Plugin fails silently; qwen-code does not appear
Error
ERROR service=plugin path=opencode-qwencode-auth
error=ENOENT: no such file or directory, open '.../src/constants.js'
failed to load plugin
Root Cause
package.json has "module": "index.ts"
- Published package has
src/constants.ts (not .js)
- ESM loader expects
.js, throws ENOENT
Verified Fix
I compiled the plugin locally and confirmed it works end-to-end:
git clone https://github.com/gustavodiasdev/opencode-qwencode-auth.git
cd opencode-qwencode-auth
bun install && bun run build
# Built dist/index.js and dist/cli.js
After manually copying compiled files and updating package.json:
- ✓
opencode auth login shows "Qwen Code"
- ✓ OAuth flow completes successfully
- ✓
qwen3-coder-plus, qwen3-coder-flash, etc. models available
Proposed Fix
Update package.json:
{
"module": "dist/index.js",
"scripts": {
"build": "bun build ./src/index.ts --outdir ./dist --target node --format esm && bun build ./src/cli.ts --outdir ./dist --target node --format esm",
"prepublishOnly": "bun run build"
},
"files": [
"dist",
"README.md"
]
}
Changes:
module points to compiled JS in dist/
prepublishOnly ensures dist/ is built before every npm publish
files ships compiled output instead of raw TypeScript
Checklist for Author
Related
Environment
- OpenCode CLI: v1.14.29
- Node.js: v20+
- OS: Linux (tested)
Willing to Contribute
I submitted PR #XX with this exact fix. The change is minimal (~5 lines) and I've already verified it works end-to-end.
Bug Report
Package:
opencode-qwencode-auth@1.3.0(npm)Affected: All OpenCode installations loading this plugin via npm
Severity: High — plugin completely non-functional
Problem
The published npm package contains only TypeScript source files (
.ts), but OpenCode's ESM plugin loader resolves imports with.jsextensions. This causes the plugin to fail on load withENOENT.Reproduction
Expected: Qwen Code appears in provider list
Actual: Plugin fails silently; qwen-code does not appear
Error
Root Cause
package.jsonhas"module": "index.ts"src/constants.ts(not.js).js, throwsENOENTVerified Fix
I compiled the plugin locally and confirmed it works end-to-end:
After manually copying compiled files and updating
package.json:opencode auth loginshows "Qwen Code"qwen3-coder-plus,qwen3-coder-flash, etc. models availableProposed Fix
Update
package.json:{ "module": "dist/index.js", "scripts": { "build": "bun build ./src/index.ts --outdir ./dist --target node --format esm && bun build ./src/cli.ts --outdir ./dist --target node --format esm", "prepublishOnly": "bun run build" }, "files": [ "dist", "README.md" ] }Changes:
modulepoints to compiled JS indist/prepublishOnlyensuresdist/is built before everynpm publishfilesships compiled output instead of raw TypeScriptChecklist for Author
package.jsonchanges abovebun run buildnpm packand verify tarball containsdist/index.jsanddist/cli.jsRelated
Environment
Willing to Contribute
I submitted PR #XX with this exact fix. The change is minimal (~5 lines) and I've already verified it works end-to-end.