From 658432579aa8e036fb8142292dc3083de0994200 Mon Sep 17 00:00:00 2001 From: jonniebigodes Date: Sat, 1 Apr 2023 15:10:36 +0100 Subject: [PATCH] Adds missing snippet for webpack --- ...storybook-main-ts-module-resolution.ts.mdx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/snippets/common/storybook-main-ts-module-resolution.ts.mdx diff --git a/docs/snippets/common/storybook-main-ts-module-resolution.ts.mdx b/docs/snippets/common/storybook-main-ts-module-resolution.ts.mdx new file mode 100644 index 000000000000..0139b6003ef5 --- /dev/null +++ b/docs/snippets/common/storybook-main-ts-module-resolution.ts.mdx @@ -0,0 +1,22 @@ +```ts +// .storybook/main.ts + +// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-webpack5) +import type { StorybookConfig } from '@storybook/your-framework'; + +import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'; + +const config: StorybookConfig = { + webpackFinal: async (config) => { + config.resolve.plugins = [ + ...(config.resolve.plugins || []), + new TsconfigPathsPlugin({ + extensions: config.resolve.extensions, + }), + ]; + return config; + }, +}; + +export default config; +```