storybook/docs/snippets/common/storybook-main-ts-module-resolution.js.mdx
2023-06-21 11:46:09 +01:00

23 lines
604 B
Plaintext

```js
// .storybook/main.js
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
export default {
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
framework: '@storybook/your-framework',
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
webpackFinal: async (config) => {
if (config.resolve) {
config.resolve.plugins = [
...(config.resolve.plugins || []),
new TsconfigPathsPlugin({
extensions: config.resolve.extensions,
}),
];
}
return config;
},
};
```