@@ -4,21 +4,50 @@ import * as nextConstants from './next.constants.mjs';
44
55/** @type {import('next').NextConfig } */
66const nextConfig = {
7+ // We intentionally disable Next.js's built-in i18n support
8+ // as we dom have our own i18n and internationalisation engine
79 i18n : null ,
810 swcMinify : true ,
11+ // We don't use trailing slashes on URLs from the Node.js Website
912 trailingSlash : false ,
10- eslint : { dirs : [ '.' ] } ,
13+ // We allow the BASE_PATH to be overridden in case that the Website
14+ // is being built on a subdirectory (e.g. /nodejs-website)
1115 basePath : nextConstants . BASE_PATH ,
16+ // We disable image optimisation during static export builds
1217 images : { unoptimized : nextConstants . ENABLE_STATIC_EXPORT } ,
18+ // On static export builds we want the output directory to be "build"
1319 distDir : nextConstants . ENABLE_STATIC_EXPORT ? 'build' : '.next' ,
20+ // On static export builds we want to enable the export feature
1421 output : nextConstants . ENABLE_STATIC_EXPORT ? 'export' : undefined ,
22+ // We don't want to run Type Checking on Production Builds
23+ // as we already check it on the CI within each Pull Request
24+ typescript : { ignoreBuildErrors : true } ,
25+ // We don't want to run ESLint Checking on Production Builds
26+ // as we already check it on the CI within each Pull Request
27+ // we also configure ESLint to run its lint checking on all files (next lint)
28+ eslint : { dirs : [ '.' ] , ignoreDuringBuilds : true } ,
1529 experimental : {
16- swcMinify : true ,
30+ // We disable the support for legacy browsers which should reduce the polyiffing
31+ // and the overall bundle size for the Node.js Website client runtime
1732 legacyBrowsers : false ,
33+ // We want all Next.js scripts to be registered as Service Workers, which
34+ // reduces the JavaScript load time on cache hits (this uses Workbox)
35+ // @see https://developer.chrome.com/docs/workbox/
1836 nextScriptWorkers : true ,
37+ // This feature reduces the Next.js memory consumption by compartimentalising
38+ // the Webpack builds into smaller threads that are responsible for building
39+ // smaller pieces of the website instead of all pages at onces
40+ // this increases slightly build time in favor of less memory usage
1941 webpackBuildWorker : true ,
42+ // Some of our static pages from `getStaticProps` have a lot of data
43+ // since we pass the fully-compiled MDX page from `MDXRemote` through
44+ // a page's static props.
2045 largePageDataBytes : 128 * 100000 ,
46+ // This allows us to use SuperJson which supports custom data types for the JSON schema
47+ // @see https://github.com/blitz-js/superjson
2148 swcPlugins : [ [ 'next-superjson-plugin' , { } ] ] ,
49+ // We disable the bundling and tracing of some files on the Serverless & Edge Runtimes
50+ // as otherwise they would explode the bundle size (server) and the tracing time
2251 outputFileTracingExcludes : {
2352 '*' : [ './public/**' , 'node_modules/**/@swc/core*' ] ,
2453 } ,
0 commit comments