mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
Fix import url on windows
This commit is contained in:
parent
8f6d23a2ab
commit
d61cfc1555
@ -1,6 +1,7 @@
|
||||
import { join, parse, relative } from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import findCacheDirectory from 'find-cache-dir';
|
||||
import fs from 'fs-extra';
|
||||
import { join, parse, relative } from 'node:path';
|
||||
import slash from 'slash';
|
||||
/**
|
||||
* Manager entries should be **self-invoking** bits of code.
|
||||
* They can of-course import from modules, and ESbuild will bundle all of that into a single file.
|
||||
@ -29,7 +30,7 @@ export async function wrapManagerEntries(entrypoints: string[]) {
|
||||
|
||||
const location = join(cacheLocation, relative(process.cwd(), dir), `${name}-bundle.mjs`);
|
||||
await fs.ensureFile(location);
|
||||
await fs.writeFile(location, `import '${entry}';`);
|
||||
await fs.writeFile(location, `import '${slash(entry)}';`);
|
||||
|
||||
return location;
|
||||
})
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { Options, CoreConfig, Builder } from '@storybook/types';
|
||||
import type { Builder, CoreConfig, Options } from '@storybook/types';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
|
||||
export async function getManagerBuilder(): Promise<Builder<unknown>> {
|
||||
return import('@storybook/builder-manager');
|
||||
@ -17,7 +18,7 @@ export async function getPreviewBuilder(
|
||||
} else {
|
||||
throw new Error('no builder configured!');
|
||||
}
|
||||
const previewBuilder = await import(builderPackage);
|
||||
const previewBuilder = await import(pathToFileURL(builderPackage).href);
|
||||
return previewBuilder;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user