Skip to content

Commit

Permalink
use dirname instead of process cwd for next dev
Browse files Browse the repository at this point in the history
  • Loading branch information
thibautsabot committed May 1, 2022
1 parent ddba1aa commit 9700de4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/next/bin/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ commands[command]()
if (command === 'dev') {
const { CONFIG_FILES } = require('../shared/lib/constants')
const { watchFile } = require('fs')
const rootProjectDir = __dirname.replace('/node_modules/next/dist/bin', '')

for (const CONFIG_FILE of CONFIG_FILES) {
watchFile(`${process.cwd()}/${CONFIG_FILE}`, (cur: any, prev: any) => {
watchFile(`${rootProjectDir}/${CONFIG_FILE}`, (cur: any, prev: any) => {
if (cur.size > 0 || prev.size > 0) {
console.log(
`\n> Found a change in ${CONFIG_FILE}. Restart the server to see the changes in effect.`
Expand Down

0 comments on commit 9700de4

Please sign in to comment.