-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Add warning when running start without build #736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
aaedc11
171b544
a9951bf
e628491
3289508
3c4c5e2
430e269
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import { resolve } from 'path' | ||
| import parseArgs from 'minimist' | ||
| import Server from '../server' | ||
| import {exists} from 'mz/fs' | ||
|
|
||
| const argv = parseArgs(process.argv.slice(2), { | ||
| alias: { | ||
|
|
@@ -38,7 +39,14 @@ if (argv.help) { | |
| const dir = resolve(argv._[0] || '.') | ||
|
|
||
| const srv = new Server({ dir }) | ||
| srv.start(argv.port) | ||
|
|
||
| exists(resolve(process.cwd(), '.next')).then(exists => { | ||
| if (!exists) { | ||
| console.error(`> Error! The application should be compiled with \`next build\` first.`) | ||
|
||
| process.exit(0) | ||
|
||
| } | ||
| srv.start(argv.port) | ||
| }) | ||
| .then(() => { | ||
| if (!process.env.NOW) { | ||
| console.log(`> Ready on http://localhost:${argv.port}`) | ||
|
|
@@ -48,3 +56,4 @@ srv.start(argv.port) | |
| console.error(err) | ||
| process.exit(1) | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be
dirnotprocess.cwd()