const path = require('path'); module.exports = async ({ config }) => ({ ...config, module: { ...config.module, rules: [ ...config.module.rules, { test: /\.stories\.jsx?$/, use: require.resolve('@storybook/addon-storysource/loader'), include: [ path.resolve(__dirname, './stories'), path.resolve(__dirname, '../../lib/ui/src'), path.resolve(__dirname, '../../lib/components/src'), ], enforce: 'pre', }, { test: /\.js/, use: config.module.rules[0].use, include: [ path.resolve(__dirname, '../../lib/ui/src'), path.resolve(__dirname, '../../lib/components/src'), ], }, { test: /\.tsx?$/, use: [ { loader: require.resolve('ts-loader'), }, ], }, ], }, resolve: { ...config.resolve, extensions: [...(config.resolve.extensions || []), '.ts', '.tsx'], }, });