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.
Clear up production build missing message for
next start
and `next …
…export` (vercel#19777) Adds an err.sh link to the production build missing message. Also clears up `valid` as `production`. Also fixes an edge case where an unhelpful error would be thrown because we checked for `.next` instead of `.next/BUILD_ID` Added the out directory location as the list line during export to make sure people know where the files are output. Fixes vercel#19778 Fixes vercel#19788
- Loading branch information
1 parent
cf46655
commit c792317
Showing
9 changed files
with
135 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Could not find a production build | ||
|
||
#### Why This Error Occurred | ||
|
||
When running `next export` a production build is needed. | ||
|
||
#### Possible Ways to Fix It | ||
|
||
- Run `next build` to create a production build before running `next export`. | ||
- If your intention was to run the development server run `next dev` instead. |
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,10 @@ | ||
# Could not find a production build | ||
|
||
#### Why This Error Occurred | ||
|
||
When running `next start` or a custom server in production mode a production build is needed. | ||
|
||
#### Possible Ways to Fix It | ||
|
||
- Run `next build` to create a production build before booting up the production server. | ||
- If your intention was to run the development server run `next dev` instead. |
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,39 @@ | ||
module.exports = { | ||
onDemandEntries: { | ||
// Make sure entries are not getting disposed. | ||
maxInactiveAge: 1000 * 60 * 60, | ||
}, | ||
rewrites() { | ||
// add a rewrite so the code isn't dead-code eliminated | ||
return [ | ||
{ | ||
source: '/some-rewrite', | ||
destination: '/', | ||
}, | ||
] | ||
}, | ||
redirects() { | ||
return [ | ||
{ | ||
source: '/redirect/me/to-about/:lang', | ||
destination: '/:lang/about', | ||
permanent: false, | ||
}, | ||
{ | ||
source: '/nonexistent', | ||
destination: '/about', | ||
permanent: false, | ||
}, | ||
{ | ||
source: '/shadowed-page', | ||
destination: '/about', | ||
permanent: false, | ||
}, | ||
{ | ||
source: '/redirect-query-test/:path', | ||
destination: '/about?foo=:path', | ||
permanent: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* eslint-env jest */ | ||
import { nextExport } from 'next-test-utils' | ||
import { join } from 'path' | ||
const appDir = join(__dirname, '../') | ||
jest.setTimeout(1000 * 60 * 5) | ||
|
||
describe('next export without build', () => { | ||
it('should show error when there is no production build', async () => { | ||
const result = await nextExport(appDir, {}, { stderr: true, stdout: true }) | ||
console.log(result.stdout, result.stderr) | ||
expect(result.stderr).toMatch(/Could not find a production build in the/) | ||
}) | ||
}) |
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,39 @@ | ||
module.exports = { | ||
onDemandEntries: { | ||
// Make sure entries are not getting disposed. | ||
maxInactiveAge: 1000 * 60 * 60, | ||
}, | ||
rewrites() { | ||
// add a rewrite so the code isn't dead-code eliminated | ||
return [ | ||
{ | ||
source: '/some-rewrite', | ||
destination: '/', | ||
}, | ||
] | ||
}, | ||
redirects() { | ||
return [ | ||
{ | ||
source: '/redirect/me/to-about/:lang', | ||
destination: '/:lang/about', | ||
permanent: false, | ||
}, | ||
{ | ||
source: '/nonexistent', | ||
destination: '/about', | ||
permanent: false, | ||
}, | ||
{ | ||
source: '/shadowed-page', | ||
destination: '/about', | ||
permanent: false, | ||
}, | ||
{ | ||
source: '/redirect-query-test/:path', | ||
destination: '/about?foo=:path', | ||
permanent: false, | ||
}, | ||
] | ||
}, | ||
} |
17 changes: 17 additions & 0 deletions
17
test/integration/production-start-no-build/test/index.test.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-env jest */ | ||
import { nextServer } from 'next-test-utils' | ||
import { join } from 'path' | ||
const appDir = join(__dirname, '../') | ||
jest.setTimeout(1000 * 60 * 5) | ||
|
||
describe('Production Usage without production build', () => { | ||
it('should show error when there is no production build', async () => { | ||
expect(() => { | ||
nextServer({ | ||
dir: appDir, | ||
dev: false, | ||
quiet: true, | ||
}) | ||
}).toThrow(/Could not find a production build in the/) | ||
}) | ||
}) |