Commit 37a86e8
committed
fix: bundle plugin to JS for server mode compatibility
Bun's on-the-fly TypeScript transpilation fails to extract named exports
from CJS modules (like @opentelemetry/*) when loaded via `await import()`
in opencode's compiled binary. This causes plugins to fail in server/CLI
mode while working fine in TUI mode.
Fix by pre-bundling all dependencies into a single JavaScript file using
`bun build`, which resolves imports at build time and avoids CJS/ESM
interop issues at runtime.
- Add `build` script: `bun build src/index.ts --outdir=./dist --target=node`
- Update exports/main/module to point to `dist/index.js`
- Add `prepublishOnly` to ensure build runs before npm publish
- Add `./server` export for explicit server mode entry point
Fixes #351 parent f79aa8e commit 37a86e8
1 file changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
48 | | - | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | | - | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
0 commit comments