Skip to content

Commit

Permalink
chore: add fix for storybook for babel 7.21
Browse files Browse the repository at this point in the history
  • Loading branch information
delanni committed Jul 6, 2023
1 parent 2d130b9 commit 344ad5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/kbn-storybook/src/lib/run_storybook_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import buildStandalone from '@storybook/react/standalone';
import { Flags, run } from '@kbn/dev-utils';
import UiSharedDepsNpm from '@kbn/ui-shared-deps-npm';
import UiSharedDepsSrc from '@kbn/ui-shared-deps-src';
import { REPO_ROOT } from '@kbn/utils';
// @ts-expect-error internal dep of storybook
import interpret from 'interpret'; // eslint-disable-line import/no-extraneous-dependencies
import * as constants from './constants';

// Convert the flags to a Storybook loglevel
Expand Down Expand Up @@ -52,6 +55,12 @@ export function runStorybookCli({ configDir, name }: { configDir: string; name:
}

logger.setLevel(getLogLevelFromFlags(flags));

// force storybook to use our transpilation rather than ts-node or anything else
interpret.extensions['.ts'] = [join(REPO_ROOT, 'src/setup_node_env')];
interpret.extensions['.tsx'] = [join(REPO_ROOT, 'src/setup_node_env')];
interpret.extensions['.jsx'] = [join(REPO_ROOT, 'src/setup_node_env')];

await buildStandalone(config);

// Line is only reached when building the static version
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-storybook/src/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export default function ({ config: storybookConfig }: { config: Configuration })

// move the plugins to the top of the preset array so they will run after the typescript preset
options.presets = [
require.resolve('@kbn/babel-preset/common_preset'),
{
plugins,
},
Expand Down

0 comments on commit 344ad5c

Please sign in to comment.