mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-16 05:03:11 +08:00
Vite: Fix glob path creation for Windows (#21305)
Closes #21101 ## What I did use the slash package instead of posix path ## How to test 1. check out the repository in windows 2. run yarn task --task build --template react-vite/default-ts --start-from=install 3. it should work --> ## Checklist **Help**: not sure about how to test this - [ ] Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests) #### Maintainers - [ ] If this PR should be tested against many or all sandboxes, make sure to add the `ci:merged` or `ci:daily` GH label to it. - [ ] Make sure this PR contains **one** of the labels below. `["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]`
This commit is contained in:
commit
73f4cc74bf
@ -1,4 +1,5 @@
|
||||
import * as posixPath from 'node:path/posix'; // Glob requires forward-slashes
|
||||
import * as path from 'path';
|
||||
import slash from 'slash';
|
||||
import { promise as glob } from 'glob-promise';
|
||||
import { normalizeStories } from '@storybook/core-common';
|
||||
|
||||
@ -11,14 +12,12 @@ export async function listStories(options: Options) {
|
||||
configDir: options.configDir,
|
||||
workingDir: options.configDir,
|
||||
}).map(({ directory, files }) => {
|
||||
const pattern = posixPath.join(directory, files);
|
||||
const pattern = path.join(directory, files);
|
||||
const absolutePattern = path.isAbsolute(pattern)
|
||||
? pattern
|
||||
: path.join(options.configDir, pattern);
|
||||
|
||||
return glob(
|
||||
posixPath.isAbsolute(pattern) ? pattern : posixPath.join(options.configDir, pattern),
|
||||
{
|
||||
follow: true,
|
||||
}
|
||||
);
|
||||
return glob(slash(absolutePattern), { follow: true });
|
||||
})
|
||||
)
|
||||
).reduce((carry, stories) => carry.concat(stories), []);
|
||||
|
Loading…
x
Reference in New Issue
Block a user