admin 015ec111bd fix(pwa): rename serwist route from [[...slug]] to [path] to match Serwist's hardcoded param
The Serwist createSerwistRoute factory returns a GET handler with
`params: Promise<{ path: string }>` hardcoded. Next.js infers the
param shape from the directory name — so the directory MUST be
named `[path]` (single segment) for the type to match.

`[[...slug]]` (catch-all) was wrong on two counts:
1. The segment name is `slug`, not `path` (Serwist expects
   exactly `path`).
2. The shape is `string[]` (array), not `string` (Serwist
   expects a single string).

Per the Serwist source comment: 'Asset and chunk names must be at
the top, as our path is /serwist/[path], not /serwist/[...path]'
— all SW output files (sw.js, workbox-XXX.js) are flat, single
segment is sufficient.

The fix is a directory rename only — the route.ts content
(createSerwistRoute call) is unchanged.

Verification:
- pnpm build now succeeds (TypeScript check passes)
- The Serwist route appears in the build output as `●  /serwist/[path]`
  prerendered with `sw.js` and `sw.js.map` static pages
- `pnpm start` + Chrome: `/serwist/sw.js` will be served by the
  route handler and registered by <SerwistProvider>
2026-06-17 11:30:57 +08:00
2026-06-05 19:09:20 +08:00
2026-06-05 19:09:20 +08:00
2026-06-15 11:37:29 +08:00
2026-06-15 14:23:31 +08:00

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Git Hooks

项目使用 .githooks/ 目录存放仓库内的 git hooks.git/hooks/)。clone 后需手动启用

git config core.hooksPath .githooks

启用的 Hook

post-receive

触发场景git push 到本仓库时(在 bare reporeceive.denyCurrentBranch=updateInstead 的非 bare repo 上)。

行为:自动执行 pnpm run build:start,即 next build && next start

注意事项

  • 本仓库的 .githooks/post-receive 自动生效 —— 必须在每个工作副本上跑一次上面的 git config 命令
  • core.hooksPath本地 git config(写入 .git/config),随仓库提交
  • post-receive接收端触发 —— 即 push 目标机器(生产 / 测试服务器)的 hook,不是本地开发机的

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details. modify

S
Description
No description provided
Readme 47 MiB
Languages
TypeScript 90.2%
CSS 6.3%
JavaScript 1.6%
Shell 1.3%
HTML 0.4%
Other 0.1%