diff --git a/lib/builder-webpack5/src/index.ts b/lib/builder-webpack5/src/index.ts index abcd1fa6fdd..6b93e1d8244 100644 --- a/lib/builder-webpack5/src/index.ts +++ b/lib/builder-webpack5/src/index.ts @@ -50,7 +50,7 @@ export const getConfig: WebpackBuilder['getConfig'] = async (options) => { ...options, babelOptions, typescriptOptions, - frameworkOptions: framework?.options, + frameworkOptions: typeof framework === 'string' ? {} : framework?.options, } ) as any; }; diff --git a/lib/builder-webpack5/src/preview/base-webpack.config.ts b/lib/builder-webpack5/src/preview/base-webpack.config.ts index 1cdcc28e493..757a8dd86b7 100644 --- a/lib/builder-webpack5/src/preview/base-webpack.config.ts +++ b/lib/builder-webpack5/src/preview/base-webpack.config.ts @@ -45,10 +45,11 @@ export async function createDefaultWebpackConfig( const isProd = storybookBaseConfig.mode !== 'development'; const coreOptions = await options.presets.apply('core'); - const builderOptions = (coreOptions.builder as Webpack5BuilderConfig).options; - const cacheConfig = builderOptions?.fsCache ? { cache: { type: 'filesystem' as const } } : {}; + const builderOptions = (coreOptions.builder as Webpack5BuilderConfig)?.options || {}; + const cacheConfig = builderOptions.fsCache ? { cache: { type: 'filesystem' as const } } : {}; const lazyCompilationConfig = - builderOptions?.lazyCompilation && !isProd ? { lazyCompilation: { entries: false } } : {}; + builderOptions.lazyCompilation && !isProd ? { lazyCompilation: { entries: false } } : {}; + return { ...storybookBaseConfig, module: { diff --git a/lib/cli/src/automigrate/fixes/webpack5.ts b/lib/cli/src/automigrate/fixes/webpack5.ts index ceb63a1c607..c6aa02f2b49 100644 --- a/lib/cli/src/automigrate/fixes/webpack5.ts +++ b/lib/cli/src/automigrate/fixes/webpack5.ts @@ -126,9 +126,9 @@ export const webpack5: Fix & CheckBuilder = { logger.info(`✅ Adding dependencies: ${deps}`); if (!dryRun) packageManager.addDependencies({ installAsDevDependencies: true }, deps); - logger.info('✅ Setting `core.builder` to `webpack5` in main.js'); + logger.info('✅ Setting `core.builder` to `@storybook/builder-webpack5` in main.js'); if (!dryRun) { - main.setFieldValue(['core', 'builder'], 'webpack5'); + main.setFieldValue(['core', 'builder'], '@storybook/builder-webpack5'); await writeConfig(main); } }, diff --git a/lib/cli/src/generators/baseGenerator.ts b/lib/cli/src/generators/baseGenerator.ts index acf1c030c7b..df7b4234487 100644 --- a/lib/cli/src/generators/baseGenerator.ts +++ b/lib/cli/src/generators/baseGenerator.ts @@ -6,6 +6,7 @@ import { getBabelDependencies, copyComponents } from '../helpers'; import { configure } from './configure'; import { getPackageDetails, JsPackageManager } from '../js-package-manager'; import { generateStorybookBabelConfigInCWD } from '../babel-config'; +import packageVersions from '../versions'; export type GeneratorOptions = { language: SupportedLanguage; @@ -104,7 +105,11 @@ export async function baseGenerator( const packageJson = packageManager.retrievePackageJson(); const installedDependencies = new Set(Object.keys(packageJson.dependencies)); - const frameworkPackage = `@storybook/${framework}`; + const frameworkPackage = (packageVersions as Record)[ + `@storybook/${framework}-${builder}` + ] + ? `@storybook/${framework}-${builder}` + : framework; const cliPackage = 'sb'; const packages = [ @@ -146,7 +151,7 @@ export async function baseGenerator( } configure(framework, { - framework: frameworkPackage, + framework: { name: frameworkPackage, options: {} }, addons: [...addons, ...stripVersions(extraAddons)], extensions, commonJs: options.commonJs, diff --git a/lib/cli/src/versions.ts b/lib/cli/src/versions.ts index 8172340e7a0..9b11c1240d1 100644 --- a/lib/cli/src/versions.ts +++ b/lib/cli/src/versions.ts @@ -16,8 +16,23 @@ export default { '@storybook/addon-storysource': '6.5.0-rc.1', '@storybook/addon-toolbars': '6.5.0-rc.1', '@storybook/addon-viewport': '6.5.0-rc.1', + + '@storybook/docs-tools': '6.5.0-rc.1', + '@storybook/react-vite': '6.5.0-rc.1', + '@storybook/html-webpack5': '6.5.0-rc.1', + '@storybook/manager-webpack5': '6.5.0-rc.1', + '@storybook/preact-webpack5': '6.5.0-rc.1', + '@storybook/react-webpack5': '6.5.0-rc.1', + '@storybook/server-webpack5': '6.5.0-rc.1', + '@storybook/svelte-webpack5': '6.5.0-rc.1', + '@storybook/vue-webpack5': '6.5.0-rc.1', + '@storybook/vue3-webpack5': '6.5.0-rc.1', + '@storybook/web-components-webpack5': '6.5.0-rc.1', + + '@storybook/core-vite': '6.5.0-rc.1', + '@storybook/core-webpack': '6.5.0-rc.1', + '@storybook/addons': '6.5.0-rc.1', - '@storybook/angular': '6.5.0-rc.1', '@storybook/api': '6.5.0-rc.1', '@storybook/builder-webpack5': '6.5.0-rc.1', '@storybook/channel-postmessage': '6.5.0-rc.1', @@ -28,30 +43,38 @@ export default { '@storybook/client-logger': '6.5.0-rc.1', '@storybook/codemod': '6.5.0-rc.1', '@storybook/components': '6.5.0-rc.1', - '@storybook/core': '6.5.0-rc.1', '@storybook/core-client': '6.5.0-rc.1', '@storybook/core-common': '6.5.0-rc.1', '@storybook/core-events': '6.5.0-rc.1', '@storybook/core-server': '6.5.0-rc.1', - '@storybook/csf-tools': '6.5.0-rc.1', - '@storybook/docs-tools': '6.5.0-rc.1', - '@storybook/ember': '6.5.0-rc.1', - '@storybook/html': '6.5.0-rc.1', '@storybook/instrumenter': '6.5.0-rc.1', - '@storybook/manager-webpack5': '6.5.0-rc.1', '@storybook/node-logger': '6.5.0-rc.1', '@storybook/postinstall': '6.5.0-rc.1', - '@storybook/preact': '6.5.0-rc.1', - '@storybook/preview-web': '6.5.0-rc.1', - '@storybook/react': '6.5.0-rc.1', '@storybook/router': '6.5.0-rc.1', - '@storybook/server': '6.5.0-rc.1', '@storybook/source-loader': '6.5.0-rc.1', '@storybook/store': '6.5.0-rc.1', - '@storybook/svelte': '6.5.0-rc.1', '@storybook/telemetry': '6.5.0-rc.1', '@storybook/theming': '6.5.0-rc.1', + '@storybook/csf-tools': '6.5.0-rc.1', '@storybook/ui': '6.5.0-rc.1', + '@storybook/preview-web': '6.5.0-rc.1', + + '@storybook/preset-html-webpack': '6.5.0-rc.1', + '@storybook/preset-preact-webpack': '6.5.0-rc.1', + '@storybook/preset-react-webpack': '6.5.0-rc.1', + '@storybook/preset-server-webpack': '6.5.0-rc.1', + '@storybook/preset-svelte-webpack': '6.5.0-rc.1', + '@storybook/preset-vue-webpack': '6.5.0-rc.1', + '@storybook/preset-vue3-webpack': '6.5.0-rc.1', + '@storybook/preset-web-components-webpack': '6.5.0-rc.1', + + '@storybook/angular': '6.5.0-rc.1', + '@storybook/ember': '6.5.0-rc.1', + '@storybook/html': '6.5.0-rc.1', + '@storybook/preact': '6.5.0-rc.1', + '@storybook/react': '6.5.0-rc.1', + '@storybook/server': '6.5.0-rc.1', + '@storybook/svelte': '6.5.0-rc.1', '@storybook/vue': '6.5.0-rc.1', '@storybook/vue3': '6.5.0-rc.1', '@storybook/web-components': '6.5.0-rc.1',