diff --git a/test/fixture/files/sql.sql b/test/fixture/files/sql.sql new file mode 100644 index 0000000000..4ba280517a --- /dev/null +++ b/test/fixture/files/sql.sql @@ -0,0 +1 @@ +-- diff --git a/test/fixture/files/sqlts.sql.ts b/test/fixture/files/sqlts.sql.ts new file mode 100644 index 0000000000..0fdb044a57 --- /dev/null +++ b/test/fixture/files/sqlts.sql.ts @@ -0,0 +1 @@ +export default "--\n"; diff --git a/test/fixture/routes/raw.ts b/test/fixture/routes/raw.ts new file mode 100644 index 0000000000..f9ae0a8c5b --- /dev/null +++ b/test/fixture/routes/raw.ts @@ -0,0 +1,12 @@ +// @ts-ignore +import sql from "../files/sql.sql"; + +// https://github.com/nitrojs/nitro/issues/2836 +import sqlts from "../files/sqlts.sql"; + +export default defineEventHandler(async () => { + return { + sql, + sqlts, + }; +}); diff --git a/test/tests.ts b/test/tests.ts index 5bc26e3d87..45c7a7607d 100644 --- a/test/tests.ts +++ b/test/tests.ts @@ -778,4 +778,12 @@ export function testNitro( expect(data).toBe(ctx.isDev ? "dev env" : "prod env"); }); }); + + it("raw imports", async () => { + const { data } = await callHandler({ url: "/raw" }); + expect(data).toMatchObject({ + sql: "--\n", + sqlts: "--\n", + }); + }); }