docs/next.config.js

69 строки
2.0 KiB
JavaScript
Исходник Обычный вид История

import fs from 'fs'
import path from 'path'
import frontmatter from 'gray-matter'
import { languageKeys } from '#src/languages/lib/languages.js'
2023-11-03 01:46:32 +03:00
import { ROOT } from '#src/frame/lib/constants.js'
const homepage = path.posix.join(ROOT, 'content/index.md')
const { data } = frontmatter(fs.readFileSync(homepage, 'utf8'))
const productIds = data.children
export default {
Heroku dev deps (#19431) * fix: req.csrfToken doesn't always exist (e.g. 500 page) * feat: update dockerfile and add nextjs to build * fix: run linter * move @babel deps -> dev deps * move webpack looking things from deps -> dev deps * move pa11y-ci to optional dep * explicitly include optional deps for pa11y * allow heroku dev deps to be installed * fix: update postcss module * fix: update dockerfile build * tmp: disable renderReact * see if another deploy is slower/faster * move a few more packages to devDeps * upgrade to package-lock v2 * use dayjs instead of date-fns * move cross-env to devDeps * remove unused 'del' package * commit husky precommit hooks * add hrtime to clone-for-build.js * Revert "add hrtime to clone-for-build.js" This reverts commit 70ee647bacce833f4ed2f621f62c63c1d85e5413. * update babel/eslint * fix: remove unused plugin * try a .slugignore * fix: heroku-postbuild to use npm run build * fix: i cannot spell dereferenced * add .next/cache to heroku cacheDirectories * test cached build * remove aws-sdk, see what breaks * move jest-puppeteer to optional deps * fix: update browser-test.yml to use newer node version * move jimp to optional dependencies * move puppeteer to optional dependencies * fix: ci optional include * fix: bad copy pasta * remove previous react experiment * update tests/README.md with note about optional deps * bump node test version back to 14 * convert package-lock back to v1 * fix: use node 15.x to leverage npm optional deps * fix: optional dep install * test: see what happens with heroku/nodejs-typescript buildpack * back to heroku/nodejs buildpack * move jest to optional * revert jest move * remove .slugignore * cleanup dockerfile, move xlsx-population to optional, add comment about optional deps * Update Dockerfile Co-authored-by: James M. Greene <JamesMGreene@github.com> Co-authored-by: James M. Greene <JamesMGreene@github.com>
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: {
ignoreBuildErrors: true,
Heroku dev deps (#19431) * fix: req.csrfToken doesn't always exist (e.g. 500 page) * feat: update dockerfile and add nextjs to build * fix: run linter * move @babel deps -> dev deps * move webpack looking things from deps -> dev deps * move pa11y-ci to optional dep * explicitly include optional deps for pa11y * allow heroku dev deps to be installed * fix: update postcss module * fix: update dockerfile build * tmp: disable renderReact * see if another deploy is slower/faster * move a few more packages to devDeps * upgrade to package-lock v2 * use dayjs instead of date-fns * move cross-env to devDeps * remove unused 'del' package * commit husky precommit hooks * add hrtime to clone-for-build.js * Revert "add hrtime to clone-for-build.js" This reverts commit 70ee647bacce833f4ed2f621f62c63c1d85e5413. * update babel/eslint * fix: remove unused plugin * try a .slugignore * fix: heroku-postbuild to use npm run build * fix: i cannot spell dereferenced * add .next/cache to heroku cacheDirectories * test cached build * remove aws-sdk, see what breaks * move jest-puppeteer to optional deps * fix: update browser-test.yml to use newer node version * move jimp to optional dependencies * move puppeteer to optional dependencies * fix: ci optional include * fix: bad copy pasta * remove previous react experiment * update tests/README.md with note about optional deps * bump node test version back to 14 * convert package-lock back to v1 * fix: use node 15.x to leverage npm optional deps * fix: optional dep install * test: see what happens with heroku/nodejs-typescript buildpack * back to heroku/nodejs buildpack * move jest to optional * revert jest move * remove .slugignore * cleanup dockerfile, move xlsx-population to optional, add comment about optional deps * Update Dockerfile Co-authored-by: James M. Greene <JamesMGreene@github.com> Co-authored-by: James M. Greene <JamesMGreene@github.com>
2021-05-25 01:40:50 +03:00
},
2021-06-17 21:55:48 +03:00
eslint: {
ignoreDuringBuilds: true,
},
i18n: {
locales: languageKeys,
defaultLocale: 'en',
},
sassOptions: {
quietDeps: true,
},
async rewrites() {
const DEFAULT_VERSION = 'free-pro-team@latest'
return productIds.map((productId) => {
return {
source: `/${productId}/:path*`,
destination: `/${DEFAULT_VERSION}/${productId}/:path*`,
}
})
},
2022-02-28 21:30:54 +03:00
webpack: (config) => {
config.experiments = config.experiments || {}
config.experiments.topLevelAwait = true
config.resolve.fallback = { fs: false }
2022-02-28 21:30:54 +03:00
return config
},
// 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,
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
2023-07-24 15:53:39 +03:00
// This makes it so that going Back will scroll to the previous position
scrollRestoration: true,
},
2023-08-09 17:30:26 +03:00
compiler: {
styledComponents: true,
},
}