Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions code/core/src/core-server/utils/StoryIndexGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,16 @@ export class StoryIndexGenerator {

const pathToSubIndex = {} as SpecifierStoriesCache;

// Calculate a new CWD for each glob to handle paths that go above the workingDir.
const globCwd = slash(resolve(workingDir, specifier.directory));
const globPattern = specifier.files;
const fullGlob = slash(join(specifier.directory, specifier.files));

// Dynamically import globby because it is a pure ESM module
// eslint-disable-next-line depend/ban-dependencies
const { globby } = await import('globby');

// Execute globby within the new CWD to ensure `ignore` patterns work correctly.
const files = await globby(globPattern, {
const files = await globby(fullGlob, {
absolute: true,
cwd: globCwd,
...commonGlobOptions(globPattern),
cwd: workingDir,
...commonGlobOptions(fullGlob),
});

if (files.length === 0 && !ignoreWarnings) {
Expand Down
Loading