From 05d31c55a9e99fba784efd6a542ce93c7f236608 Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Mon, 15 May 2023 20:03:20 +1000 Subject: [PATCH] Rename .storybook/main.js to main.ts and add type to make it works --- .storybook/{main.js => main.ts} | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) rename .storybook/{main.js => main.ts} (78%) diff --git a/.storybook/main.js b/.storybook/main.ts similarity index 78% rename from .storybook/main.js rename to .storybook/main.ts index 6a0b028..18b0a55 100644 --- a/.storybook/main.js +++ b/.storybook/main.ts @@ -1,6 +1,9 @@ +import { StorybookConfig } from '@storybook/react-webpack5'; + const path = require('path'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); -module.exports = { + +const config: StorybookConfig = { stories: ['../src/**/*.stories.tsx'], addons: [ '@storybook/addon-links', @@ -13,6 +16,9 @@ module.exports = { options: {}, }, webpackFinal: async config => { + if (!config.resolve) { + config.resolve = {}; + } config.resolve.plugins = config.resolve.plugins || []; config.resolve.plugins.push( new TsconfigPathsPlugin({ @@ -25,3 +31,5 @@ module.exports = { autodocs: true, }, }; + +export default config;