diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index fa3a28bbd6329..4dbabf4165a9e 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -1717,12 +1717,16 @@ export default async function build( require('next/dist/compiled/glob') as typeof import('next/dist/compiled/glob') const glob = (pattern: string): Promise => { return new Promise((resolve, reject) => { - globOrig(pattern, { cwd: dir }, (err, files) => { - if (err) { - return reject(err) + globOrig( + pattern, + { cwd: dir, nodir: true, dot: true }, + (err, files) => { + if (err) { + return reject(err) + } + resolve(files) } - resolve(files) - }) + ) }) } diff --git a/test/integration/build-trace-extra-entries/app/include-me/.dot-folder/another-file.txt b/test/integration/build-trace-extra-entries/app/include-me/.dot-folder/another-file.txt new file mode 100644 index 0000000000000..b6fc4c620b67d --- /dev/null +++ b/test/integration/build-trace-extra-entries/app/include-me/.dot-folder/another-file.txt @@ -0,0 +1 @@ +hello \ No newline at end of file diff --git a/test/integration/build-trace-extra-entries/app/include-me/some-dir/file.txt b/test/integration/build-trace-extra-entries/app/include-me/some-dir/file.txt new file mode 100644 index 0000000000000..6b584e8ece562 --- /dev/null +++ b/test/integration/build-trace-extra-entries/app/include-me/some-dir/file.txt @@ -0,0 +1 @@ +content \ No newline at end of file diff --git a/test/integration/build-trace-extra-entries/app/next.config.js b/test/integration/build-trace-extra-entries/app/next.config.js index c9f5e197007b5..37dc43828fe2f 100644 --- a/test/integration/build-trace-extra-entries/app/next.config.js +++ b/test/integration/build-trace-extra-entries/app/next.config.js @@ -21,7 +21,7 @@ module.exports = { }, experimental: { outputFileTracingIncludes: { - '/index': ['include-me/*'], + '/index': ['include-me/**/*'], }, outputFileTracingExcludes: { '/index': ['public/exclude-me/**/*'], diff --git a/test/integration/build-trace-extra-entries/test/index.test.js b/test/integration/build-trace-extra-entries/test/index.test.js index 1513257a629d5..e14cc432195f4 100644 --- a/test/integration/build-trace-extra-entries/test/index.test.js +++ b/test/integration/build-trace-extra-entries/test/index.test.js @@ -38,6 +38,17 @@ describe('build trace with extra entries', () => { expect( indexTrace.files.some((file) => file.endsWith('hello.json')) ).toBeFalsy() + expect( + indexTrace.files.some((file) => file.endsWith('some-dir')) + ).toBeFalsy() + expect( + indexTrace.files.some((file) => + file.endsWith('.dot-folder/another-file.txt') + ) + ).toBe(true) + expect( + indexTrace.files.some((file) => file.endsWith('some-dir/file.txt')) + ).toBe(true) expect( indexTrace.files.some((file) => file.includes('some-cms/index.js')) ).toBe(true)