Scope
import { logger } from 'hono/logger' fails to compile under Perry-native. hono/logger pulls in hono/dist/utils/color.js, which uses a dynamic import() whose path argument isn't a literal:
Error: dynamic import() in module node_modules/hono/dist/utils/color.js: path argument
references a binding that is not a module-level const initialized to a literal (only string
literals, ternaries, template literals over const locals, and the module-level consts
themselves are supported)
This blocks the app.use('*', logger()) line in the #1655 acceptance program.
Repro (Perry @ main 6a77dd7, hono@4.10)
import { Hono } from 'hono'
import { logger } from 'hono/logger'
const app = new Hono()
app.use('*', logger())
app.get('/', (c) => c.text('ok'))
perry compile app.tsx → the error above.
Context
#1655 explicitly lists dynamic imports as "out of scope … call-site workarounds exist", so this may be WONTFIX for the tracker — but the literal 30-line acceptance program uses logger(), so flagging it. Options: (a) relax the dynamic-import guard for this color-detection pattern, (b) treat hono/logger as needing a compilePackages-level shim, or (c) accept it as out-of-scope and drop logger() from the acceptance.
The rest of the acceptance (HTML via c.html(<Layout/>), c.json, query parsing, POST body) works end-to-end through @hono/perry-server — only logger() is blocked.
Related
Scope
import { logger } from 'hono/logger'fails to compile under Perry-native.hono/loggerpulls inhono/dist/utils/color.js, which uses a dynamicimport()whose path argument isn't a literal:This blocks the
app.use('*', logger())line in the #1655 acceptance program.Repro (Perry @ main 6a77dd7, hono@4.10)
perry compile app.tsx→ the error above.Context
#1655 explicitly lists dynamic imports as "out of scope … call-site workarounds exist", so this may be WONTFIX for the tracker — but the literal 30-line acceptance program uses
logger(), so flagging it. Options: (a) relax the dynamic-import guard for this color-detection pattern, (b) treathono/loggeras needing a compilePackages-level shim, or (c) accept it as out-of-scope and droplogger()from the acceptance.The rest of the acceptance (HTML via
c.html(<Layout/>),c.json, query parsing, POST body) works end-to-end through@hono/perry-server— onlylogger()is blocked.Related