Skip to content

Commit

Permalink
feat: installed pwa with serwist to install app from browser
Browse files Browse the repository at this point in the history
  • Loading branch information
gurtatiLND committed Nov 26, 2024
1 parent 8dc9a01 commit d4088e2
Show file tree
Hide file tree
Showing 15 changed files with 445 additions and 109 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# Serwist
public/sw*
public/swe-worker*
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
20 changes: 16 additions & 4 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import type { NextConfig } from "next";
import type { NextConfig } from 'next';
import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from 'next/constants';
import serwist from '@serwist/next';

const nextConfig: NextConfig = {
/* config options here */
const baseConfig = {
// Base Next.js config
};

export default nextConfig;
export default async (phase: any) => {
if (phase === PHASE_DEVELOPMENT_SERVER || phase === PHASE_PRODUCTION_BUILD) {
const withSerwist = serwist({
swSrc: 'src/app/sw.ts',
swDest: 'public/sw.js',
});
return withSerwist(baseConfig);
}

return baseConfig;
};
Loading

0 comments on commit d4088e2

Please sign in to comment.