Builder implemented with webpack5 and webpack5-compatible loaders/plugins/config, used by @storybook/core-server to build the manager UI
—
Webpack5 configuration generation with manager-specific settings, plugin configuration, entry point management, and Storybook composition support.
Generates the complete webpack configuration for building the Storybook manager UI.
/**
* Generate webpack configuration for manager build
* @param options - Storybook configuration options
* @returns Promise resolving to complete webpack Configuration
*/
function getManagerWebpackConfig(options: Options): Promise<Configuration>;
interface Options {
/** Path to Storybook configuration directory */
configDir: string;
/** Output directory for built files */
outputDir?: string;
/** Preset collection for configuration */
presets: PresetCollection;
/** Cache provider for build optimization */
cache?: CacheProvider;
/** Enable manager caching */
managerCache?: boolean;
/** Smoke test mode flag */
smokeTest?: boolean;
/** Configuration type (DEVELOPMENT|PRODUCTION) */
configType?: string;
/** Documentation mode flag */
docsMode?: boolean;
/** Preview URL for manager */
previewUrl?: string;
/** Version check configuration */
versionCheck?: any;
/** Release notes data */
releaseNotesData?: any;
/** Feature flags */
features?: Record<string, any>;
/** Server channel URL */
serverChannelUrl?: string;
}Usage Examples:
import { getManagerWebpackConfig } from "@storybook/manager-webpack5/manager-config";
const config = await getManagerWebpackConfig({
configDir: '.storybook',
outputDir: './storybook-static',
presets: presetCollection,
configType: 'PRODUCTION',
cache: cacheProvider,
managerCache: true,
});
console.log('Entry points:', config.entry);
console.log('Output path:', config.output?.path);Automatically discovers Storybook composition references from package dependencies.
/**
* Auto-discover Storybook composition refs from dependencies
* @param options - Storybook configuration options
* @param disabledRefs - Array of ref IDs to exclude from discovery
* @returns Promise resolving to array of discovered refs
*/
function getAutoRefs(options: Options, disabledRefs?: string[]): Promise<Ref[]>;
interface Ref {
/** Unique identifier for the ref */
id: string;
/** URL where the Storybook is hosted */
url: string;
/** Display title for the ref */
title: string;
/** Version of the referenced Storybook */
version?: string;
/** Type indicating server accessibility */
type?: 'server-checked' | 'unknown';
}Usage Examples:
import { getAutoRefs } from "@storybook/manager-webpack5/manager-config";
// Discover all available refs
const allRefs = await getAutoRefs(options);
// Discover refs excluding specific ones
const filteredRefs = await getAutoRefs(options, [
'@company/design-system',
'@company/legacy-components'
]);
console.log('Available composition refs:', allRefs);Core webpack configuration preset with plugins, loaders, and optimization settings.
/**
* Configure webpack for manager build with plugins and loaders
* @param config - Base webpack configuration (usually empty)
* @param options - Extended options with manager-specific settings
* @returns Promise resolving to complete webpack Configuration
*/
function managerWebpack(
config: Configuration,
options: Options & ManagerWebpackOptions
): Promise<Configuration>;
interface ManagerWebpackOptions {
/** Webpack entry points */
entries: string[];
/** Composition refs configuration */
refs?: Record<string, Ref>;
/** Modern build flag */
modern?: boolean;
}Usage Examples:
import { managerWebpack } from "@storybook/manager-webpack5/presets/manager-preset";
const finalConfig = await managerWebpack({}, {
configDir: '.storybook',
outputDir: './storybook-static',
configType: 'PRODUCTION',
entries: ['./src/manager.ts'],
refs: discoveredRefs,
modern: true,
presets: presetCollection,
});Determines the entry points for the manager bundle including addons and configuration.
/**
* Determine entry points for manager bundle
* @param installedAddons - Array of installed addon names
* @param options - Entry point configuration options
* @returns Promise resolving to array of entry point paths
*/
function managerEntries(
installedAddons: string[],
options: ManagerEntryOptions
): Promise<string[]>;
interface ManagerEntryOptions {
/** Main manager entry point */
managerEntry?: string;
/** Path to Storybook configuration directory */
configDir: string;
/** Enable modern build mode */
modern?: boolean;
}Usage Examples:
import { managerEntries } from "@storybook/manager-webpack5/presets/manager-preset";
const entries = await managerEntries(
['@storybook/addon-actions', '@storybook/addon-controls'],
{
configDir: '.storybook',
managerEntry: '@storybook/core-client/dist/esm/manager',
modern: false,
}
);
console.log('Manager entry points:', entries);Creates babel-loader webpack rule configuration for manager-specific transpilation.
/**
* Create babel-loader webpack rule for manager
* @returns Webpack rule configuration for babel-loader
*/
function babelLoader(): RuleSetRule;
interface RuleSetRule {
test: RegExp;
use: LoaderConfig[];
include: string[];
exclude: RegExp[];
}
interface LoaderConfig {
loader: string;
options: BabelLoaderOptions;
}
interface BabelLoaderOptions {
sourceType: 'unambiguous';
presets: string[];
plugins: string[];
babelrc: false;
configFile: false;
}Usage Examples:
import { babelLoader } from "@storybook/manager-webpack5/presets/babel-loader-manager";
const babelRule = babelLoader();
const webpackConfig = {
module: {
rules: [
babelRule,
// ... other rules
],
},
};The webpack configuration includes:
Install with Tessl CLI
npx tessl i tessl/npm-storybook--manager-webpack5