From 2a99d325da36b39b82b10060a07a45832357f035 Mon Sep 17 00:00:00 2001 From: Ashelyn Dawn Date: Sun, 5 Apr 2020 21:48:38 -0600 Subject: [PATCH] Fix so nonexistant dirs throw an error --- components/{errorBoundary => }/errorBoundary.js | 0 components/{errorDisplay => }/errorDisplay.js | 0 next.config.js | 7 ++++--- 3 files changed, 4 insertions(+), 3 deletions(-) rename components/{errorBoundary => }/errorBoundary.js (100%) rename components/{errorDisplay => }/errorDisplay.js (100%) diff --git a/components/errorBoundary/errorBoundary.js b/components/errorBoundary.js similarity index 100% rename from components/errorBoundary/errorBoundary.js rename to components/errorBoundary.js diff --git a/components/errorDisplay/errorDisplay.js b/components/errorDisplay.js similarity index 100% rename from components/errorDisplay/errorDisplay.js rename to components/errorDisplay.js diff --git a/next.config.js b/next.config.js index b4eb0ef..904aff2 100644 --- a/next.config.js +++ b/next.config.js @@ -35,12 +35,13 @@ class CustomResolver { const resolvedDir = path.join(__dirname, match.groups.dir, dirPath.join('/')) - let selectedPath = request.request + // Default to basic (no extension) + let selectedPath = path.join(resolvedDir, componentDir) + // Attempt a few paths with an extension, just in case const pathsToCheck = [ path.join(resolvedDir, componentDir, componentDir + '.js'), - path.join(resolvedDir, componentDir + '.js'), - path.join(resolvedDir, componentDir) + path.join(resolvedDir, componentDir + '.js') ] for(const path of pathsToCheck)