diff --git a/scripts/tasks/sandbox-parts.ts b/scripts/tasks/sandbox-parts.ts index 0f826a81343e..4245a1b01952 100644 --- a/scripts/tasks/sandbox-parts.ts +++ b/scripts/tasks/sandbox-parts.ts @@ -13,6 +13,7 @@ import { } from 'fs-extra'; import { join, resolve, sep } from 'path'; +import slash from 'slash'; import type { Task } from '../task'; import { executeCLIStep, steps } from '../utils/cli-step'; import { installYarn2, configureYarn2ForVerdaccio, addPackageResolutions } from '../utils/yarn'; @@ -262,8 +263,8 @@ function addStoriesEntry(mainConfig: ConfigFile, path: string) { const stories = mainConfig.getFieldValue(['stories']) as string[]; const entry = { - directory: join('../template-stories', path), - titlePrefix: path, + directory: slash(join('../template-stories', path)), + titlePrefix: slash(path), files: '**/*.@(mdx|stories.@(js|jsx|ts|tsx))', }; diff --git a/scripts/utils/main-js.ts b/scripts/utils/main-js.ts index b2e6e966fce1..a9517f515617 100644 --- a/scripts/utils/main-js.ts +++ b/scripts/utils/main-js.ts @@ -1,6 +1,7 @@ import { existsSync } from 'fs'; import { join, resolve } from 'path'; +import slash from 'slash'; import type { ConfigFile } from '../../code/lib/csf-tools'; import { readConfig } from '../../code/lib/csf-tools'; import { getInterpretedFile } from '../../code/lib/core-common'; @@ -19,5 +20,5 @@ export async function readMainConfig({ cwd }: { cwd: string }) { export function addPreviewAnnotations(mainConfig: ConfigFile, paths: string[]) { const config = mainConfig.getFieldValue(['previewAnnotations']) as string[]; - mainConfig.setFieldValue(['previewAnnotations'], [...(config || []), ...paths]); + mainConfig.setFieldValue(['previewAnnotations'], [...(config || []), ...paths.map(slash)]); }