|
| 1 | +import { cp } from 'node:fs/promises'; |
| 2 | +import { join, parse, resolve } from 'node:path'; |
1 | 3 | import rollupPluginNodeResolve from '@rollup/plugin-node-resolve';
|
2 | 4 | import { getBuilderOptions } from '@storybook/core-common';
|
3 | 5 | import { logger } from '@storybook/node-logger';
|
4 |
| -import { globals } from '@storybook/preview/globals'; |
| 6 | +import { globalsNameReferenceMap } from '@storybook/preview/globals'; |
5 | 7 | import type { Builder, Options, StorybookConfig as StorybookConfigBase } from '@storybook/types';
|
6 | 8 | import { DevServerConfig, mergeConfigs, startDevServer } from '@web/dev-server';
|
7 | 9 | import type { DevServer } from '@web/dev-server-core';
|
8 | 10 | import { fromRollup } from '@web/dev-server-rollup';
|
9 | 11 | import { rollupPluginHTML } from '@web/rollup-plugin-html';
|
10 | 12 | import express from 'express';
|
11 |
| -import * as fs from 'fs-extra'; |
12 |
| -import { join, parse, resolve } from 'path'; |
13 | 13 | import { OutputOptions, RollupBuild, RollupOptions, rollup } from 'rollup';
|
14 | 14 | import rollupPluginExternalGlobals from 'rollup-plugin-external-globals';
|
15 | 15 | import { generateIframeHtml } from './generate-iframe-html.js';
|
@@ -74,7 +74,7 @@ export const start: WdsBuilder['start'] = async ({ startTime, options, router, s
|
74 | 74 | },
|
75 | 75 | wdsPluginPrebundleModules(env),
|
76 | 76 | wdsPluginStorybookBuilder(options),
|
77 |
| - wdsPluginExternalGlobals(globals), |
| 77 | + wdsPluginExternalGlobals(globalsNameReferenceMap), |
78 | 78 | ],
|
79 | 79 | };
|
80 | 80 |
|
@@ -146,7 +146,7 @@ export const build: WdsBuilder['build'] = async ({ startTime, options }) => {
|
146 | 146 | rollupPluginNodeResolve(),
|
147 | 147 | rollupPluginPrebundleModules(env),
|
148 | 148 | rollupPluginStorybookBuilder(options),
|
149 |
| - rollupPluginExternalGlobals(globals), |
| 149 | + rollupPluginExternalGlobals(globalsNameReferenceMap), |
150 | 150 | ],
|
151 | 151 | };
|
152 | 152 |
|
@@ -179,7 +179,8 @@ export const build: WdsBuilder['build'] = async ({ startTime, options }) => {
|
179 | 179 |
|
180 | 180 | const previewDirOrigin = join(getNodeModuleDir('@storybook/preview'), 'dist');
|
181 | 181 | const previewDirTarget = join(options.outputDir || '', `sb-preview`);
|
182 |
| - const previewFiles = fs.copy(previewDirOrigin, previewDirTarget, { |
| 182 | + const previewFiles = cp(previewDirOrigin, previewDirTarget, { |
| 183 | + recursive: true, |
183 | 184 | filter: src => {
|
184 | 185 | const { ext } = parse(src);
|
185 | 186 | if (ext) {
|
|
0 commit comments