Skip to content

Commit

Permalink
fix: unique imports for server-handlers-meta (#2945)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZerxZ authored Dec 19, 2024
1 parent cb5b36d commit 26726be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rollup/plugins/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ ${handlers
},
"#nitro-internal-virtual/server-handlers-meta": () => {
const handlers = getHandlers();
const imports = unique(handlers.map((h) => h.handler));
return /* js */ `
${handlers
${imports
.map(
(h) => `import ${getImportId(h.handler)}Meta from "${h.handler}?meta";`
(handler) => `import ${getImportId(handler)}Meta from "${handler}?meta";`
)
.join("\n")}
export const handlersMeta = [
Expand Down
4 changes: 4 additions & 0 deletions test/fixture/nitro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export default defineNitroConfig({
// @ts-expect-error #2382
method: "GET",
},
{
route: "/api/hello2",
handler: "~/api/hello.ts",
},
],
devProxy: {
"/proxy/example": { target: "https://example.com", changeOrigin: true },
Expand Down

0 comments on commit 26726be

Please sign in to comment.