nitro-public-module
Version:
nitro module for better public compatibility | 对于 nitro 更好的静态资源兼容模块
16 lines (13 loc) • 335 B
text/typescript
import { createPublicFallbackMiddleware } from "#nitro-public";
export default createPublicFallbackMiddleware((p) => {
// maybe other file type
if (p.includes(".") && !p.endsWith(".html")) {
return {
file: p,
};
}
return {
file: p.endsWith(".html") ? p : `${p}.html`,
contentType: "text/html",
};
});