SPB Git

Repository Public

next.config.mjs 1.2 KB 29 lines javascript

1import { PHASE_DEVELOPMENT_SERVER } from 'next/constants.js';23/**4 * Static export only. In `next dev` (and only there) /api is proxied to the dev mock5 * server; rewrites do not exist in the exported build, where apps/server serves /api.6 */7export default function config(phase) {8  const dev = phase === PHASE_DEVELOPMENT_SERVER;9  const mock = `http://127.0.0.1:${process.env.MOCK_PORT ?? '8641'}`;10  /** @type {import('next').NextConfig} */11  const cfg = {12    trailingSlash: true,13    images: { unoptimized: true },14    reactStrictMode: true,15    transpilePackages: ['@aos/shared'],16    typescript: { ignoreBuildErrors: false },17    // Always inlined (empty when unset) so that the E2E test hook and the dev-only WebSocket18    // origin are compiled OUT of production bundles instead of being read at runtime.19    env: {20      NEXT_PUBLIC_E2E: process.env.NEXT_PUBLIC_E2E ?? '',21      NEXT_PUBLIC_DEV_WS_ORIGIN: dev ? (process.env.NEXT_PUBLIC_DEV_WS_ORIGIN ?? '') : '',22    },23    ...(dev24      ? { rewrites: async () => [{ source: '/api/:path*', destination: `${mock}/api/:path*` }], skipTrailingSlashRedirect: true }25      : { output: 'export' }),26  };27  return cfg;28}29
Files main
Menu

Theme