|
1 | 1 | const path = require('path') |
| 2 | +const MiniCssExtractPlugin = require('mini-css-extract-plugin') |
2 | 3 |
|
3 | 4 | // see typescript setup |
4 | 5 | // https://storybook.js.org/docs/configurations/typescript-config/ |
5 | 6 | module.exports = ({ config }) => { |
6 | 7 | config.module.rules.push({ |
7 | 8 | test: /\.scss$/, |
8 | | - use: ['style-loader', 'css-loader', 'sass-loader'], |
| 9 | + use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'], |
9 | 10 | include: path.resolve(__dirname, '../'), |
10 | 11 | }) |
11 | 12 | config.module.rules.push({ |
12 | 13 | test: /\.(ts|tsx)$/, |
13 | 14 | loader: require.resolve('babel-loader'), |
14 | 15 | options: { |
15 | | - presets: [['react-app', { flow: false, typescript: true }]], |
| 16 | + plugins: [ |
| 17 | + [ |
| 18 | + 'babel-plugin-import', |
| 19 | + { |
| 20 | + libraryName: '@alifd/next', |
| 21 | + style: true, |
| 22 | + }, |
| 23 | + ], |
| 24 | + ], |
| 25 | + presets: [ |
| 26 | + // react-app |
| 27 | + ['react-app', { flow: false, typescript: true }], |
| 28 | + // allow emotion css prop on html |
| 29 | + ['@emotion/babel-preset-css-prop'], |
| 30 | + ], |
16 | 31 | }, |
17 | 32 | }) |
| 33 | + |
| 34 | + config.plugins.push(new MiniCssExtractPlugin({ filename: '[name].css' })) |
| 35 | + |
18 | 36 | config.resolve.extensions.push('.ts', '.tsx') |
19 | 37 |
|
20 | 38 | config.resolve.modules = ['node_modules', path.resolve(__dirname, '../src')] |
|
0 commit comments