diff options
Diffstat (limited to '.storybook/webpack.config.js')
-rw-r--r-- | .storybook/webpack.config.js | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js index a923d80..27e132b 100644 --- a/.storybook/webpack.config.js +++ b/.storybook/webpack.config.js @@ -1,39 +1,19 @@ - const path = require('path'); -const webpack = require('webpack'); -const svgFolder = './assets/icons/'; -const fs = require('fs'); - -let iconNames = []; -fs.readdirSync(svgFolder).forEach(file => { - let fileName = file.split('.'); - if (fileName[0] && fileName[1] === 'svg') { - iconNames.push(fileName[0]); - } -}); +module.exports = baseConfig => { + baseConfig.module.rules.push({ + test: [/\.stories\.ts?$/, /index\.ts$/], + loaders: [ + { + loader: require.resolve('@storybook/addon-storysource/loader'), + options: { + parser: 'typescript', + }, + }, + ], + include: [path.resolve(__dirname, '../stories/angular')], + enforce: 'pre', + }); -module.exports = { - module: { - rules: [ - { - test: /.scss$/, - use: ['style-loader', 'css-loader', 'sass-loader'], - include: path.resolve(__dirname, '../') - }, - { - test: /.html$/, - loader: 'html-loader', - options: { - minimize: false - } - } - ] - }, - plugins: [ - new webpack.DefinePlugin({ - 'ICON_PATH': '"./"', - 'ICON_NAMES':JSON.stringify(iconNames) - }) - ] + return baseConfig; }; |