Use defineRouteMeta and define a key that is 'number-like',
For example:
defineRouteMeta({ "myKey": "this works!", "200": "this does not", 200: "neither does this" })
Describe the bug
After doing the repro
npm run dev
Inspect the built code at .nitro/dev/index.mjs and notice that your handlersMeta.meta looks like this:
const [handlerUid] = {"myKey":"this works!","undefined":"neither does this"};
Environment
Nitro: Nightly Node: v21.7.3
Reproduction
The easiest way to replicate this issue is
For example:
defineRouteMeta({ "myKey": "this works!", "200": "this does not", 200: "neither does this" })
Describe the bug
After doing the repro
npm run dev
Inspect the built code at
.nitro/dev/index.mjs
and notice that yourhandlersMeta.meta
looks like this:const [handlerUid] = {"myKey":"this works!","undefined":"neither does this"};
Additional context
The issue appears to be from this line: https://github.com/unjs/nitro/blob/5bcc0a2b951cbcafb9eec9fe62ddb949d1accad8/src/rollup/plugins/handlers-meta.ts#L84
Where ObjectExpressions that don't return a .name property are keyed as undefined. A possible fix could be to check for .value as well.