remove next-pwa for now

This commit is contained in:
m5r 2021-08-20 08:31:18 +08:00
parent 77a1471974
commit c0370030ce
3 changed files with 19 additions and 14 deletions

View File

@ -1,8 +1,11 @@
import { BlitzConfig, sessionMiddleware, simpleRolesIsAuthorized } from "blitz";
/// <reference path='./next-pwa.d.ts' />
import type { BlitzConfig } from "blitz";
import { sessionMiddleware, simpleRolesIsAuthorized } from "blitz";
// import withPWA from "next-pwa";
const withPWA = require("next-pwa");
type Module = Omit<NodeModule, "exports"> & { exports: BlitzConfig };
const config: BlitzConfig = {
(module as Module).exports = {
middleware: [
sessionMiddleware({
cookiePrefix: "shellphone",
@ -49,15 +52,8 @@ const config: BlitzConfig = {
return config
},
*/
/*pwa: {
dest: "public",
disable: process.env.NODE_ENV !== "production",
},*/
};
module.exports =
process.env.NODE_ENV === "test"
? config
: withPWA({
...config,
pwa: {
dest: "public",
disable: process.env.NODE_ENV !== "production",
},
});

7
next-pwa.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import type { BlitzConfig } from "blitz";
declare module "next-pwa" {
function withPWA(config: BlitzConfig): BlitzConfig;
export default withPWA;
}

View File

@ -1,3 +1,5 @@
jest.mock("next-pwa", () => ({ __esModule: true, default: jest.fn().mockImplementation((config) => config) }));
import { setConfig } from "blitz";
// see https://github.com/vercel/next.js/issues/4024