Skip to content

Commit

Permalink
Merge pull request #21644 from storybookjs/tom/21632-fix-missing-fram…
Browse files Browse the repository at this point in the history
…ework-options

React: Fix missing framework options in shim
  • Loading branch information
shilman authored Mar 17, 2023
2 parents 8d09434 + cc7b5b6 commit 64ada05
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions code/lib/react-dom-shim/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import type { Options } from '@storybook/types';
import { version } from 'react-dom/package.json';

export const webpackFinal = async (config: any, options: Options) => {
const { legacyRootApi } = await options.presets.apply<{ legacyRootApi?: boolean }>(
'frameworkOptions'
);
const { legacyRootApi } =
(await options.presets.apply<{ legacyRootApi?: boolean } | null>('frameworkOptions')) || {};

const isReact18 = version.startsWith('18') || version.startsWith('0.0.0');
const useReact17 = legacyRootApi ?? !isReact18;
Expand All @@ -24,9 +23,8 @@ export const webpackFinal = async (config: any, options: Options) => {
};

export const viteFinal = async (config: any, options: Options) => {
const { legacyRootApi } = await options.presets.apply<{ legacyRootApi?: boolean }>(
'frameworkOptions'
);
const { legacyRootApi } =
(await options.presets.apply<{ legacyRootApi?: boolean } | null>('frameworkOptions')) || {};

const isReact18 = version.startsWith('18') || version.startsWith('0.0.0');
const useReact17 = legacyRootApi || !isReact18;
Expand Down

0 comments on commit 64ada05

Please sign in to comment.