This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove deprecated features and enable future flag (vercel#26066)
- Enables excludeDefaultMomentLocales by default - Adds distDir cleaning (See RFC vercel#6009) - Adds support for `PORT` - Removes `router.events` from the server-side router as it should not be used server-side (long-standing todo that is potentially breaking). Note that it's still available as `Router.events` (import Router from 'next/router') and with `useRouter` in `useEffect`. Using it with `useEffect` is the correct way and I've updated the upgrading guide to reflect that - Added webpack 5 to the upgrading guide - Removed `Head.rewind` as it's been a no-op since Next.js 9.5 and can now be safely removed from user code Fixes vercel#11408 Fixes vercel#10338 Fixes vercel#5554 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added ## Feature - [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. ## Documentation / Examples - [ ] Make sure the linting passes
- Loading branch information
1 parent
ef59147
commit f47ee59
Showing
21 changed files
with
252 additions
and
25 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
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
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 @@ | ||
module.exports = {} |
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 @@ | ||
export default () => 'hello from index' |
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,75 @@ | ||
/* eslint-env jest */ | ||
|
||
import fs from 'fs-extra' | ||
import { join } from 'path' | ||
import { nextBuild } from 'next-test-utils' | ||
|
||
jest.setTimeout(1000 * 60 * 2) | ||
|
||
const appDir = join(__dirname, '../') | ||
const customFile = join(appDir, '.next/extra-file.txt') | ||
const cacheDir = join(appDir, '.next/cache') | ||
const nextConfig = join(appDir, 'next.config.js') | ||
|
||
let nextConfigContent | ||
|
||
async function checkFileWrite(existsAfterBuild) { | ||
await nextBuild(appDir) | ||
fs.writeFileSync(customFile, 'this is a testing file') | ||
await nextBuild(appDir) | ||
expect(fs.existsSync(customFile)).toBe(existsAfterBuild) | ||
// `.next/cache` should be preserved in all cases | ||
expect(fs.existsSync(cacheDir)).toBe(true) | ||
} | ||
|
||
const runTests = () => { | ||
it('should clean up .next before build start', async () => { | ||
await checkFileWrite(false) | ||
}) | ||
} | ||
|
||
describe('Cleaning distDir', () => { | ||
describe('server mode', () => { | ||
runTests() | ||
}) | ||
|
||
describe('serverless mode', () => { | ||
beforeAll(async () => { | ||
nextConfigContent = await fs.readFile(nextConfig, 'utf8') | ||
await fs.writeFile( | ||
nextConfig, | ||
` | ||
module.exports = { | ||
target: 'serverless' | ||
} | ||
` | ||
) | ||
}) | ||
afterAll(async () => { | ||
await fs.writeFile(nextConfig, nextConfigContent) | ||
}) | ||
|
||
runTests() | ||
}) | ||
|
||
describe('disabled write', () => { | ||
beforeAll(async () => { | ||
nextConfigContent = await fs.readFile(nextConfig, 'utf8') | ||
await fs.writeFile( | ||
nextConfig, | ||
` | ||
module.exports = { | ||
cleanDistDir: false | ||
} | ||
` | ||
) | ||
}) | ||
afterAll(async () => { | ||
await fs.writeFile(nextConfig, nextConfigContent) | ||
}) | ||
|
||
it('should not clean up .next before build start', async () => { | ||
await checkFileWrite(true) | ||
}) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
module.exports = { | ||
cleanDistDir: false, | ||
// update me | ||
env: { | ||
nextConfigEnv: process.env.ENV_KEY_IN_NEXT_CONFIG, | ||
|
4 changes: 3 additions & 1 deletion
4
test/integration/font-optimization/fixtures/with-google/next.config.js
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
module.exports = {} | ||
module.exports = { | ||
cleanDistDir: false, | ||
} |
4 changes: 3 additions & 1 deletion
4
test/integration/font-optimization/fixtures/with-typekit/next.config.js
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
module.exports = {} | ||
module.exports = { | ||
cleanDistDir: false, | ||
} |
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 |
---|---|---|
@@ -1,5 +1 @@ | ||
module.exports = { | ||
future: { | ||
excludeDefaultMomentLocales: true, | ||
}, | ||
} | ||
module.exports = {} |
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 @@ | ||
module.exports = {} |
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 @@ | ||
export default () => 'hello from index' |
Oops, something went wrong.