2022-07-26 20:53:23 +03:00
|
|
|
import fs from 'fs'
|
|
|
|
import path from 'path'
|
2022-08-22 19:50:18 +03:00
|
|
|
|
|
|
|
import frontmatter from 'gray-matter'
|
2022-08-26 17:45:17 +03:00
|
|
|
import { languageKeys } from './lib/languages.js'
|
2023-02-06 22:29:45 +03:00
|
|
|
import { ROOT } from './lib/constants.js'
|
2022-08-22 19:50:18 +03:00
|
|
|
|
2023-02-06 22:29:45 +03:00
|
|
|
const homepage = path.posix.join(ROOT, 'content/index.md')
|
2021-07-14 23:49:18 +03:00
|
|
|
const { data } = frontmatter(fs.readFileSync(homepage, 'utf8'))
|
|
|
|
const productIds = data.children
|
2021-05-05 18:23:46 +03:00
|
|
|
|
2022-07-26 20:53:23 +03:00
|
|
|
export default {
|
2021-05-25 01:40:50 +03:00
|
|
|
// speed up production `next build` by ignoring typechecking during that step of build.
|
|
|
|
// type-checking still occurs in the Dockerfile build
|
|
|
|
typescript: {
|
2021-07-15 00:35:01 +03:00
|
|
|
ignoreBuildErrors: true,
|
2021-05-25 01:40:50 +03:00
|
|
|
},
|
2021-06-17 21:55:48 +03:00
|
|
|
eslint: {
|
|
|
|
ignoreDuringBuilds: true,
|
|
|
|
},
|
2021-05-05 18:23:46 +03:00
|
|
|
i18n: {
|
2022-08-26 17:45:17 +03:00
|
|
|
locales: languageKeys,
|
2021-07-15 00:35:01 +03:00
|
|
|
defaultLocale: 'en',
|
2021-05-05 18:23:46 +03:00
|
|
|
},
|
2021-06-16 22:47:01 +03:00
|
|
|
sassOptions: {
|
2021-07-15 00:35:01 +03:00
|
|
|
quietDeps: true,
|
2021-06-16 22:47:01 +03:00
|
|
|
},
|
2021-07-15 00:35:01 +03:00
|
|
|
async rewrites() {
|
2021-05-06 00:54:49 +03:00
|
|
|
const DEFAULT_VERSION = 'free-pro-team@latest'
|
2021-05-05 18:23:46 +03:00
|
|
|
return productIds.map((productId) => {
|
|
|
|
return {
|
|
|
|
source: `/${productId}/:path*`,
|
2021-07-15 00:35:01 +03:00
|
|
|
destination: `/${DEFAULT_VERSION}/${productId}/:path*`,
|
2021-05-05 18:23:46 +03:00
|
|
|
}
|
|
|
|
})
|
2021-07-15 00:35:01 +03:00
|
|
|
},
|
2022-02-28 21:30:54 +03:00
|
|
|
webpack: (config) => {
|
|
|
|
config.experiments = config.experiments || {}
|
|
|
|
config.experiments.topLevelAwait = true
|
2023-05-10 21:54:56 +03:00
|
|
|
config.resolve.fallback = { fs: false }
|
2022-02-28 21:30:54 +03:00
|
|
|
return config
|
|
|
|
},
|
2022-05-23 15:12:09 +03:00
|
|
|
|
|
|
|
// https://nextjs.org/docs/api-reference/next.config.js/compression
|
|
|
|
compress: false,
|
2022-06-03 02:10:05 +03:00
|
|
|
|
|
|
|
// ETags break stale content serving from the CDN. When a response has
|
|
|
|
// an ETag, the CDN attempts to revalidate the content in the background.
|
|
|
|
// This causes problems with serving stale content, since upon revalidating
|
|
|
|
// the CDN marks the cached content as "fresh".
|
|
|
|
generateEtags: false,
|
2022-08-09 13:58:08 +03:00
|
|
|
|
|
|
|
experimental: {
|
|
|
|
// The output of our getServerSideProps() return large chunks of
|
|
|
|
// data because it contains our rendered Markdown.
|
|
|
|
// The default, for a "Large Page Data" warning is 128KB
|
|
|
|
// but many of our pages are much larger.
|
|
|
|
// The warning is: https://nextjs.org/docs/messages/large-page-data
|
|
|
|
largePageDataBytes: 1024 * 1024, // 1 MB
|
|
|
|
},
|
2021-05-05 18:23:46 +03:00
|
|
|
}
|