diff --git a/packages/commonjs/src/dynamic-modules.js b/packages/commonjs/src/dynamic-modules.js index c00c21511..a9ddaa2ca 100644 --- a/packages/commonjs/src/dynamic-modules.js +++ b/packages/commonjs/src/dynamic-modules.js @@ -41,7 +41,9 @@ export function getDynamicRequireModules(patterns, dynamicRequireRoot) { isNegated ? dynamicRequireModules.delete(targetPath) : dynamicRequireModules.set(targetPath, resolvedPath); - for (const path of glob.sync(isNegated ? pattern.substr(1) : pattern)) { + for (const path of glob + .sync(isNegated ? pattern.substr(1) : pattern) + .sort((a, b) => a.localeCompare(b, 'en'))) { const resolvedPath = resolve(path); const requirePath = normalizePathSlashes(resolvedPath); if (isDirectory(resolvedPath)) {