fix: nop if we aren't in development
This commit is contained in:
parent
4d591a6ad9
commit
8a88163f6f
|
@ -3,7 +3,13 @@ import * as fs from "node:fs";
|
|||
import * as path from "node:path";
|
||||
|
||||
export const GET: APIRoute = ({ params, request }) => {
|
||||
if (process.env.MODE !== "development") {
|
||||
return new Response();
|
||||
}
|
||||
const filePath = path.resolve(process.cwd(), "dist/sw.js");
|
||||
const fileContents = fs.readFileSync(filePath);
|
||||
return new Response(fileContents, { status: 200, headers: { 'Content-Type': 'application/javascript' } });
|
||||
}
|
||||
return new Response(fileContents, {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/javascript" },
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue