From f2f9090a50f42bb894fc7ea3db48e1b125ea85fa Mon Sep 17 00:00:00 2001 From: Luke Fender Date: Tue, 29 Dec 2020 11:12:36 -0500 Subject: [PATCH] Ignore emacs lockfiles (#20497) Fixes: https://github.com/vercel/next.js/issues/15278 > Bug report > When using next dev with emacs, as you develop, emacs creates symbolic link files starting with .# as lock files. Next.js seems to attempt to load these but fails, spewing out errors constantly. Prevents dev server from crashing when emacs creates lockfiles tested with: - GNU Emacs 27.1 - OSX 11.1 - Node v15.4.0 --- .gitignore | 1 + packages/next/build/webpack-config.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bc9176f4c40b..f043ec68d93f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ test/**/next-env.d.ts # Editors **/.idea +**/.#* # examples examples/**/out diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index 462d51590348..4b732e9681e7 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -712,6 +712,8 @@ export default async function getBaseWebpackConfig( callback() } + const emacsLockfilePattern = '**/.#*' + let webpackConfig: webpack.Configuration = { externals: !isServer ? // make sure importing "next" is handled gracefully for client @@ -788,7 +790,13 @@ export default async function getBaseWebpackConfig( } }, watchOptions: { - ignored: ['**/.git/**', '**/node_modules/**', '**/.next/**'], + ignored: [ + '**/.git/**', + '**/node_modules/**', + '**/.next/**', + // can be removed after https://github.com/paulmillr/chokidar/issues/955 is released + emacsLockfilePattern, + ], }, output: { ...(isWebpack5