mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 07:03:25 +00:00
feat: pwa support
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
const { i18n } = require('./next-i18next.config');
|
||||
const {
|
||||
PHASE_DEVELOPMENT_SERVER,
|
||||
PHASE_PRODUCTION_BUILD,
|
||||
} = require('next/constants');
|
||||
|
||||
/** @type {import("next").NextConfig} */
|
||||
const config = {
|
||||
const nextConfig = {
|
||||
i18n,
|
||||
webpack(config) {
|
||||
config.module.rules.push({
|
||||
@@ -24,4 +28,12 @@ const config = {
|
||||
output: 'standalone',
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
module.exports = (phase) => {
|
||||
if (phase === PHASE_DEVELOPMENT_SERVER || phase === PHASE_PRODUCTION_BUILD) {
|
||||
const withPWA = require('@ducanh2912/next-pwa').default({
|
||||
dest: 'public',
|
||||
});
|
||||
return withPWA(nextConfig);
|
||||
}
|
||||
return nextConfig;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user