mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-25 09:51:58 +00:00
fix(core): resolve watcher binding require lazily (#42122)
This commit is contained in:
parent
c9539979bd
commit
d8f62cfdcb
1 changed files with 3 additions and 2 deletions
|
|
@ -2,9 +2,10 @@ import { createRequire } from "node:module"
|
|||
|
||||
declare const OPENCODE_LIBC: string | undefined
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
|
||||
// Lazy: on workerd import.meta.url is undefined and the watcher is never
|
||||
// loaded, so createRequire must not run at module scope.
|
||||
export default function load() {
|
||||
const require = createRequire(import.meta.url)
|
||||
const libc = typeof OPENCODE_LIBC === "undefined" ? undefined : OPENCODE_LIBC
|
||||
return require(
|
||||
process.env.OPENCODE_PARCEL_WATCHER_PATH ??
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue