Skip to content

compilePackages: builtin import resolves to undefined inside a compiled dependency (@hono/node-server → createServer undefined) #8749

Description

@proggeramlug

Env: perry 0.5.1512 built from main@6173ff9f6, macOS arm64. MB24 Phase-0 spike.

Symptom: with @hono/node-server@1.19.17 + hono@4.13.4 in perry.compilePackages, serve({ fetch: app.fetch, port }) crashes:

Cannot read properties of undefined (reading 'listen')

@hono/node-server dist/index.mjs:

import { createServer as createServerHTTP } from "http";   // line 2

const createServer = options.createServer || createServerHTTP;  // 645
const server = createServer(options.serverOptions || {}, requestListener); // → undefined(...)

Isolation: at application level both import shapes are fine —

import { createServer as a } from "http";       // typeof a === "function"
import { createServer as b } from "node:http";  // typeof b === "function"

so the builtin binding is lost specifically when the import lives inside a compilePackages-compiled dependency (or in the options.createServer || createServerHTTP module-scope reference path).

Expected: builtin imports inside compiled deps bind like app-level ones; hono serving over node:http works (was #589, closed — this appears to be a different, compilePackages-specific gap).

Full test: mobilitybroker24/monorepo spike/tests/09-hono.ts.

Activity

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