fix: prevent stale Pascal chunk failures

This commit is contained in:
134 2026-07-13 16:48:47 +08:00
parent 392c5b2a00
commit f29433a91b
3 changed files with 9 additions and 14 deletions

View File

@ -17,18 +17,20 @@ location = __PASCAL_BASE_PATH__ {
return 302 __PASCAL_BASE_PATH__/scenes;
}
# Versioned application chunks and bundled public assets contain no user data.
# Serving them without an auth subrequest prevents an expired/rotating session
# from turning a harmless static request into an Nginx 500 response.
# Production uses Webpack content-hashed chunk names, so changed assets always
# receive a new URL and can be cached immutably without crossing deployments.
# Static assets contain no user data and need no auth subrequest.
location ^~ __PASCAL_BASE_PATH__/_next/static/ {
proxy_pass http://__PASCAL_NGINX_UPSTREAM__;
proxy_http_version 1.1;
proxy_hide_header X-Powered-By;
proxy_hide_header Cache-Control;
proxy_hide_header Expires;
proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_buffering on;
expires 7d;
add_header Cache-Control "public, max-age=604800, immutable" always;
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
location ^~ __PASCAL_BASE_PATH__/icons/ {

View File

@ -9,15 +9,8 @@
// `loaded` guard inside `../lib/bootstrap` keeps the side effect
// idempotent under HMR.
import '../lib/bootstrap'
import { type ReactNode, useEffect } from 'react'
import type { ReactNode } from 'react'
export function ClientBootstrap({ children }: { children: ReactNode }) {
useEffect(() => {
if (process.env.NODE_ENV !== 'development') return
// Loaded here (not via a `<Script>` tag in <head>) to avoid React's
// "script inside a React component" hydration warning. The package
// is already a direct dep, so we don't need the CDN auto-global.
import('react-scan').then(({ scan }) => scan({ enabled: true }))
}, [])
return children
}

View File

@ -5,7 +5,7 @@
"private": true,
"scripts": {
"dev": "dotenv -e ../../.env.local -- bun --bun next dev --port 3002",
"build": "dotenv -e ../../.env.local -- next build",
"build": "dotenv -e ../../.env.local -- next build --webpack",
"start": "bun --bun next start",
"lint": "biome lint",
"check-types": "next typegen && tsgo --noEmit"