Skip to content

Commit

Permalink
fix(nextjs): support config files with dots in filename
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed May 24, 2023
1 parent d030a21 commit 238bb4d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('Next.js config: getWithNxContent', () => {
expect(modulePaths).toEqual([
'nested/a.cjs',
'nested/b.cjs',
'nested-c.cjs',
'nested.c.cjs',
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ export function ensureFileExtensions(
): string[] {
const extensions = ['.js', '.cjs', '.mjs'];
return files.map((file) => {
if (extname(file)) return file;
const providedExt = extname(file);
if (providedExt && extensions.includes(providedExt)) return file;

const ext = extensions.find((ext) =>
existsSync(join(absoluteDir, file + ext))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require('./a'); // Circular dependency should be handled
require('../nested-c'); // one level up
require('../nested.c'); // one level up
module.exports = {};

0 comments on commit 238bb4d

Please sign in to comment.