diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js b/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js index afc18c9e96f1c..bfc90197d25d1 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js @@ -80,8 +80,12 @@ class Runner { async parseEverything() { // FIXME: this should all use gatsby's configuration to determine parsable // files (and how to parse them) - let files = glob.sync(`${this.fragmentsDir}/**/*.+(t|j)s?(x)`) - files = files.concat(glob.sync(`${this.baseDir}/**/*.+(t|j)s?(x)`)) + let files = glob.sync(`${this.fragmentsDir}/**/*.+(t|j)s?(x)`, { + nodir: true, + }) + files = files.concat( + glob.sync(`${this.baseDir}/**/*.+(t|j)s?(x)`, { nodir: true }) + ) files = files.filter(d => !d.match(/\.d\.ts$/)) files = files.map(normalize)