Skip to content

Commit c9bfba6

Browse files
Kevin Donahueleo
authored andcommitted
Only watch config file that exists on the level of source files (vercel#1643)
1 parent 0ed3978 commit c9bfba6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bin/next

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env node
22

3-
import { join } from 'path'
3+
import { join, resolve } from 'path'
44
import { spawn } from 'cross-spawn'
55
import { watchFile } from 'fs'
66
import pkg from '../../package.json'
7+
import getConfig from '../server/config'
78

89
if (pkg.peerDependencies) {
910
Object.keys(pkg.peerDependencies).forEach(dependency => {
@@ -78,9 +79,10 @@ const startProcess = () => {
7879
}
7980

8081
let proc = startProcess()
82+
const { pagesDirectory = resolve(process.cwd(), 'pages') } = getConfig(process.cwd())
8183

8284
if (cmd === 'dev') {
83-
watchFile(join(process.cwd(), 'next.config.js'), (cur, prev) => {
85+
watchFile(`${resolve(pagesDirectory, '..')}/next.config.js`, (cur, prev) => {
8486
if (cur.size > 0 || prev.size > 0) {
8587
console.log('\n> Found a change in next.config.js, restarting the server...')
8688
// Don't listen to 'close' now since otherwise parent gets killed by listener

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy