diff --git a/web/config/index.ts b/web/config/index.ts index 167c87ae34..35ea3780a8 100644 --- a/web/config/index.ts +++ b/web/config/index.ts @@ -42,8 +42,8 @@ export const AMPLITUDE_API_KEY = getStringConfig( '', ) -export const IS_DEV = env.NODE_ENV === 'development' -export const IS_PROD = env.NODE_ENV === 'production' +export const IS_DEV = process.env.NODE_ENV === 'development' +export const IS_PROD = process.env.NODE_ENV === 'production' export const SUPPORT_MAIL_LOGIN = env.NEXT_PUBLIC_SUPPORT_MAIL_LOGIN diff --git a/web/env.ts b/web/env.ts index f240fcd980..f931c48677 100644 --- a/web/env.ts +++ b/web/env.ts @@ -153,12 +153,8 @@ export const env = createEnv({ */ TEXT_GENERATION_TIMEOUT_MS: coercedNumber.default(60000), }, - shared: { - NODE_ENV: z.enum(['development', 'test', 'production']).default('development'), - }, client: clientSchema, experimental__runtimeEnv: { - NODE_ENV: process.env.NODE_ENV, NEXT_PUBLIC_ALLOW_EMBED: isServer ? process.env.NEXT_PUBLIC_ALLOW_EMBED : getRuntimeEnvFromBody('allowEmbed'), NEXT_PUBLIC_ALLOW_UNSAFE_DATA_SCHEME: isServer ? process.env.NEXT_PUBLIC_ALLOW_UNSAFE_DATA_SCHEME : getRuntimeEnvFromBody('allowUnsafeDataScheme'), NEXT_PUBLIC_AMPLITUDE_API_KEY: isServer ? process.env.NEXT_PUBLIC_AMPLITUDE_API_KEY : getRuntimeEnvFromBody('amplitudeApiKey'), diff --git a/web/next.config.ts b/web/next.config.ts index 2236278a74..591c210fe9 100644 --- a/web/next.config.ts +++ b/web/next.config.ts @@ -3,7 +3,7 @@ import createMDX from '@next/mdx' import { codeInspectorPlugin } from 'code-inspector-plugin' import { env } from './env' -const isDev = env.NODE_ENV === 'development' +const isDev = process.env.NODE_ENV === 'development' const withMDX = createMDX({ extension: /\.mdx?$/, options: { diff --git a/web/package.json b/web/package.json index e0df37836e..d352943328 100644 --- a/web/package.json +++ b/web/package.json @@ -31,9 +31,9 @@ "dev:vinext": "vinext dev", "build": "next build", "build:docker": "next build && node scripts/optimize-standalone.js", - "build:vinext": "cross-env NODE_ENV=production vinext build", + "build:vinext": "vinext build", "start": "node ./scripts/copy-and-start.mjs", - "start:vinext": "cross-env NODE_ENV=production vinext start", + "start:vinext": "vinext start", "lint": "eslint --cache --concurrency=auto", "lint:ci": "eslint --cache --concurrency 2", "lint:fix": "pnpm lint --fix", @@ -247,7 +247,7 @@ "tsx": "4.21.0", "typescript": "5.9.3", "uglify-js": "3.19.3", - "vinext": "https://pkg.pr.new/hyoban/vinext@cfae669", + "vinext": "https://pkg.pr.new/hyoban/vinext@a30ba79", "vite": "8.0.0-beta.16", "vite-tsconfig-paths": "6.1.1", "vitest": "4.0.18", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 81ecb7f857..3251493a13 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -608,8 +608,8 @@ importers: specifier: 3.19.3 version: 3.19.3 vinext: - specifier: https://pkg.pr.new/hyoban/vinext@cfae669 - version: https://pkg.pr.new/hyoban/vinext@cfae669(next@16.1.5(@babel/core@7.29.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(sass@1.93.2))(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(typescript@5.9.3)(vite@8.0.0-beta.16(@types/node@24.10.12)(esbuild@0.27.2)(jiti@1.21.7)(sass@1.93.2)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.2))(webpack@5.104.1(esbuild@0.27.2)(uglify-js@3.19.3)) + specifier: https://pkg.pr.new/hyoban/vinext@a30ba79 + version: https://pkg.pr.new/hyoban/vinext@a30ba79(next@16.1.5(@babel/core@7.29.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(sass@1.93.2))(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(typescript@5.9.3)(vite@8.0.0-beta.16(@types/node@24.10.12)(esbuild@0.27.2)(jiti@1.21.7)(sass@1.93.2)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.2))(webpack@5.104.1(esbuild@0.27.2)(uglify-js@3.19.3)) vite: specifier: 8.0.0-beta.16 version: 8.0.0-beta.16(@types/node@24.10.12)(esbuild@0.27.2)(jiti@1.21.7)(sass@1.93.2)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.2) @@ -7727,8 +7727,8 @@ packages: vfile@6.0.3: resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} - vinext@https://pkg.pr.new/hyoban/vinext@cfae669: - resolution: {integrity: sha512-4SRm/Dkou0Ib0UYexP8xg0G83jIM17XPUC32uXwLHt5lO47AisblMpDZXTh84fhN058FEHtPaAGtoFThaoZLIw==, tarball: https://pkg.pr.new/hyoban/vinext@cfae669} + vinext@https://pkg.pr.new/hyoban/vinext@a30ba79: + resolution: {integrity: sha512-yx/gCneOli5eGTrLUq6/M7A6DGQs14qOJW/Xp9RN6sTI0mErKyWWjO5E7FZT98BJbqH5xzI5nk8EOCLF3bojkA==, tarball: https://pkg.pr.new/hyoban/vinext@a30ba79} version: 0.0.5 engines: {node: '>=22'} hasBin: true @@ -16291,7 +16291,7 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.3 - vinext@https://pkg.pr.new/hyoban/vinext@cfae669(next@16.1.5(@babel/core@7.29.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(sass@1.93.2))(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(typescript@5.9.3)(vite@8.0.0-beta.16(@types/node@24.10.12)(esbuild@0.27.2)(jiti@1.21.7)(sass@1.93.2)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.2))(webpack@5.104.1(esbuild@0.27.2)(uglify-js@3.19.3)): + vinext@https://pkg.pr.new/hyoban/vinext@a30ba79(next@16.1.5(@babel/core@7.29.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(sass@1.93.2))(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(typescript@5.9.3)(vite@8.0.0-beta.16(@types/node@24.10.12)(esbuild@0.27.2)(jiti@1.21.7)(sass@1.93.2)(terser@5.46.0)(tsx@4.21.0)(yaml@2.8.2))(webpack@5.104.1(esbuild@0.27.2)(uglify-js@3.19.3)): dependencies: '@unpic/react': 1.0.2(next@16.1.5(@babel/core@7.29.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(sass@1.93.2))(react-dom@19.2.4(react@19.2.4))(react@19.2.4) '@vercel/og': 0.8.6 diff --git a/web/proxy.ts b/web/proxy.ts index bc4a4a3d89..8d7c28153e 100644 --- a/web/proxy.ts +++ b/web/proxy.ts @@ -22,7 +22,7 @@ export function proxy(request: NextRequest) { }, }) - const isWhiteListEnabled = !!env.NEXT_PUBLIC_CSP_WHITELIST && env.NODE_ENV === 'production' + const isWhiteListEnabled = !!env.NEXT_PUBLIC_CSP_WHITELIST && process.env.NODE_ENV === 'production' if (!isWhiteListEnabled) return wrapResponseWithXFrameOptions(response, pathname) diff --git a/web/vite.config.ts b/web/vite.config.ts index a3e1cb77ef..9cfa6a8e7b 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -71,10 +71,10 @@ const createForceInspectorClientInjectionPlugin = (): Plugin => { } export default defineConfig(({ mode }) => { - const isDev = mode === 'development' + const isTest = mode === 'test' return { - plugins: mode === 'test' + plugins: isTest ? [ tsconfigPaths(), react(), @@ -89,12 +89,8 @@ export default defineConfig(({ mode }) => { } as Plugin, ] : [ - ...(isDev - ? [ - createCodeInspectorPlugin(), - createForceInspectorClientInjectionPlugin(), - ] - : []), + createCodeInspectorPlugin(), + createForceInspectorClientInjectionPlugin(), vinext(), ], resolve: { @@ -104,7 +100,7 @@ export default defineConfig(({ mode }) => { }, // vinext related config - ...(mode !== 'test' + ...(!isTest ? { optimizeDeps: { exclude: ['nuqs'],