mirror of
https://github.com/langgenius/dify.git
synced 2026-01-14 06:07:33 +08:00
15 lines
555 B
TypeScript
15 lines
555 B
TypeScript
import { spawnSync } from 'node:child_process'
|
|
import { randomUUID } from 'node:crypto'
|
|
import { createSerwistRoute } from '@serwist/turbopack'
|
|
|
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || ''
|
|
const revision = spawnSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf-8' }).stdout?.trim() || randomUUID()
|
|
|
|
export const { dynamic, dynamicParams, revalidate, generateStaticParams, GET } = createSerwistRoute({
|
|
additionalPrecacheEntries: [{ url: `${basePath}/_offline.html`, revision }],
|
|
swSrc: 'app/sw.ts',
|
|
nextConfig: {
|
|
basePath,
|
|
},
|
|
})
|