init native nextjs pwa
This commit is contained in:
@@ -1,24 +1,49 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const withPWA = require("next-pwa")({
|
||||
dest: "public",
|
||||
register: true,
|
||||
skipWaiting: true,
|
||||
disable: process.env.NODE_ENV === "development",
|
||||
});
|
||||
|
||||
// const nextConfig: NextConfig = {
|
||||
// /* config options here */
|
||||
// reactStrictMode: true,
|
||||
// };
|
||||
|
||||
const nextConfig: NextConfig = withPWA({
|
||||
/* config options here */
|
||||
const nextConfig: NextConfig = {
|
||||
reactStrictMode: true,
|
||||
output: "standalone",
|
||||
images: {
|
||||
formats: ["image/webp", "image/avif"],
|
||||
},
|
||||
});
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
source: "/(.*)",
|
||||
headers: [
|
||||
{
|
||||
key: "X-Content-Type-Options",
|
||||
value: "nosniff",
|
||||
},
|
||||
{
|
||||
key: "X-Frame-Options",
|
||||
value: "DENY",
|
||||
},
|
||||
{
|
||||
key: "Referrer-Policy",
|
||||
value: "strict-origin-when-cross-origin",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
source: "/sw.js",
|
||||
headers: [
|
||||
{
|
||||
key: "Content-Type",
|
||||
value: "application/javascript; charset=utf-8",
|
||||
},
|
||||
{
|
||||
key: "Cache-Control",
|
||||
value: "no-cache, no-store, must-revalidate",
|
||||
},
|
||||
{
|
||||
key: "Content-Security-Policy",
|
||||
value: "default-src 'self'; script-src 'self'",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
Reference in New Issue
Block a user