Skip to content

Commit

Permalink
Merge pull request #21013 from storybookjs/vite/windows-globs
Browse files Browse the repository at this point in the history
Vite: Use posix paths for glob
  • Loading branch information
shilman committed Feb 9, 2023
2 parents 34b4920 + 038f94d commit 1e662a2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions code/lib/builder-vite/src/list-stories.ts
@@ -1,4 +1,4 @@
import * as path from 'path';
import * as posixPath from 'node:path/posix'; // Glob requires forward-slashes
import { promise as glob } from 'glob-promise';
import { normalizeStories } from '@storybook/core-common';

Expand All @@ -11,11 +11,14 @@ export async function listStories(options: Options) {
configDir: options.configDir,
workingDir: options.configDir,
}).map(({ directory, files }) => {
const pattern = path.join(directory, files);
const pattern = posixPath.join(directory, files);

return glob(path.isAbsolute(pattern) ? pattern : path.join(options.configDir, pattern), {
follow: true,
});
return glob(
posixPath.isAbsolute(pattern) ? pattern : posixPath.join(options.configDir, pattern),
{
follow: true,
}
);
})
)
).reduce((carry, stories) => carry.concat(stories), []);
Expand Down

0 comments on commit 1e662a2

Please sign in to comment.