| | import fs from 'fs' |
| | import path from 'path' |
| | import type { NextConfig } from 'next' |
| |
|
| | import frontmatter from '@gr2m/gray-matter' |
| | import { getLogLevelNumber } from '@/observability/logger/lib/log-levels' |
| | import { languageKeys } from '@/languages/lib/languages' |
| |
|
| | const ROOT = process.env.ROOT || '.' |
| | const homepage = path.posix.join(ROOT, 'content/index.md') |
| | const { data } = frontmatter(fs.readFileSync(homepage, 'utf8')) |
| | const productIds = data.children as string[] |
| |
|
| | const config: NextConfig = { |
| | |
| | |
| | transpilePackages: ['@primer/react'], |
| | |
| | |
| | typescript: { |
| | ignoreBuildErrors: true, |
| | }, |
| |
|
| | i18n: { |
| | locales: languageKeys, |
| | defaultLocale: 'en', |
| | }, |
| | sassOptions: { |
| | quietDeps: true, |
| | silenceDeprecations: [ |
| | 'legacy-js-api', |
| | 'import', |
| | 'global-builtin', |
| | 'color-4-api', |
| | 'mixed-decls', |
| | ], |
| | }, |
| | |
| | |
| | logging: getLogLevelNumber() < 3 ? undefined : {}, |
| | async rewrites() { |
| | const DEFAULT_VERSION = 'free-pro-team@latest' |
| | return productIds.map((productId) => { |
| | return { |
| | source: `/${productId}/:path*`, |
| | destination: `/${DEFAULT_VERSION}/${productId}/:path*`, |
| | } |
| | }) |
| | }, |
| |
|
| | webpack: (webpackConfig) => { |
| | webpackConfig.resolve.fallback = { fs: false, async_hooks: false } |
| | return webpackConfig |
| | }, |
| |
|
| | |
| | |
| |
|
| | |
| | turbopack: { |
| | resolveAlias: { |
| | fs: { |
| | browser: './empty.ts', |
| | }, |
| | async_hooks: { |
| | browser: './empty.ts', |
| | }, |
| | }, |
| | }, |
| |
|
| | |
| | compress: false, |
| |
|
| | |
| | |
| | |
| | |
| | generateEtags: false, |
| |
|
| | compiler: { |
| | styledComponents: true, |
| | }, |
| | } |
| |
|
| | export default config |
| |
|