-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Create shared Next.js baseline config (#34259)
- Loading branch information
1 parent
dec47d6
commit 174076b
Showing
13 changed files
with
130 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
let DEPLOY_ENV = 'development'; | ||
|
||
// Same as process.env.PULL_REQUEST_ID | ||
if (process.env.CONTEXT === 'deploy-preview') { | ||
DEPLOY_ENV = 'pull-request'; | ||
} | ||
|
||
if (process.env.CONTEXT === 'production' || process.env.CONTEXT === 'branch-deploy') { | ||
DEPLOY_ENV = 'production'; | ||
} | ||
|
||
if ( | ||
process.env.CONTEXT === 'branch-deploy' && | ||
(process.env.HEAD === 'master' || process.env.HEAD === 'next') | ||
) { | ||
DEPLOY_ENV = 'staging'; | ||
} | ||
|
||
process.env.DEPLOY_ENV = DEPLOY_ENV; | ||
|
||
function withDocsInfra(nextConfig) { | ||
return { | ||
trailingSlash: true, | ||
// Can be turned on when https://github.com/vercel/next.js/issues/24640 is fixed | ||
optimizeFonts: false, | ||
reactStrictMode: true, | ||
...nextConfig, | ||
env: { | ||
BUILD_ONLY_ENGLISH_LOCALE: true, // disable translations by default | ||
// production | staging | pull-request | development | ||
DEPLOY_ENV, | ||
...nextConfig.env, | ||
// https://docs.netlify.com/configure-builds/environment-variables/#git-metadata | ||
// reference ID (also known as “SHA” or “hash”) of the commit we’re building. | ||
COMMIT_REF: process.env.COMMIT_REF, | ||
// ID of the PR and the Deploy Preview it generated (for example, 1211) | ||
PULL_REQUEST_ID: process.env.REVIEW_ID, | ||
// This can be set manually in the .env to see the ads in dev mode. | ||
ENABLE_AD_IN_DEV_MODE: process.env.ENABLE_AD_IN_DEV_MODE, | ||
// URL representing the unique URL for an individual deploy, e.g. | ||
// https://5b243e66dd6a547b4fee73ae--petsof.netlify.app | ||
NETLIFY_DEPLOY_URL: process.env.DEPLOY_URL, | ||
// Name of the site, its Netlify subdomain; for example, material-ui-docs | ||
NETLIFY_SITE_NAME: process.env.SITE_NAME, | ||
}, | ||
experimental: { | ||
scrollRestoration: true, | ||
...nextConfig.experimental, | ||
}, | ||
eslint: { | ||
ignoreDuringBuilds: true, | ||
...nextConfig.eslint, | ||
}, | ||
typescript: { | ||
// Motivated by https://github.com/vercel/next.js/issues/7687 | ||
ignoreBuildErrors: true, | ||
...nextConfig.typescript, | ||
}, | ||
}; | ||
} | ||
|
||
module.exports = withDocsInfra; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.