Skip to content

Synchronous plugin hooks #123

Closed
Closed

Description

@pi0x

The resolveId, load and transform hooks of the plugin are all async, which prevents using it with env-runner's SelfEnvRunner (its plugins run inside sync module.registerHooks loader hooks, and a hook returning a Promise fails the import). Nitro wants this for nitro serve without a worker.

None of them needs to be async: this.resolve() can be awaited only when it returns a Promise (env-runner's self runner returns the result directly), load can use readFileSync, and getWasmImports / readNearestPackageJSON can read package.json synchronously. With these changes applied to a local copy, Nitro's builder: false fixture (importing a .wasm with ESM exports) works on the self runner, while bundlers keep working since sync hooks are valid there.

Opened with AI assistance.

Activity

  1. added a commit that references this issue on Oct 19, 2026
    6fb5295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions