repo是开源的
// next.config.js
const withPWA = require("next-pwa");
module.exports = withPWA({
pwa: {
dest: "public",
sw: '/sw.js'
},
});活着
我已经检查了PWA是否正在处理上述URL或未使用
function isPwa() {
return ["fullscreen", "standalone", "minimal-ui"].some(
(displayMode) => window.matchMedia('(display-mode: ' + displayMode + ')').matches
);
}
isPwa() // false
// https://stackoverflow.com/questions/41742390/javascript-to-check-if-pwa-or-mobile-web发布于 2021-11-21 05:02:40
您可能希望像这样使用next-pwa包:
const withPWA = require("next-pwa");
const runtimeCaching = require("next-pwa/cache");
module.exports = withPWA({
pwa: {
dest: "public",
runtimeCaching,
disable: process.env.NODE_ENV === "development",
}
});https://stackoverflow.com/questions/70051895
复制相似问题