2019-03-06 08:43:02 +03:00
|
|
|
const {resolve} = require('path')
|
|
|
|
const sourcePath = resolve(__dirname, '../src')
|
2017-08-18 02:25:33 +03:00
|
|
|
|
2019-03-06 09:07:53 +03:00
|
|
|
module.exports = ({config}) => {
|
2019-03-06 08:43:02 +03:00
|
|
|
const babel = config.module.rules.find(rule => {
|
|
|
|
return rule.test.test('test.js')
|
|
|
|
}).use[0]
|
2017-08-16 21:28:16 +03:00
|
|
|
|
2019-03-06 08:43:02 +03:00
|
|
|
config.module.rules = config.module.rules.filter(rule => {
|
|
|
|
return !rule.test.test('test.md')
|
2018-03-26 23:56:20 +03:00
|
|
|
})
|
|
|
|
|
2019-03-06 08:43:02 +03:00
|
|
|
config.module.rules.push(
|
|
|
|
{
|
|
|
|
test: /\.md$/,
|
|
|
|
include: sourcePath,
|
|
|
|
loaders: [
|
|
|
|
babel,
|
|
|
|
{
|
2019-03-06 09:10:06 +03:00
|
|
|
loader: require.resolve('./story-loader'),
|
2019-03-06 08:43:02 +03:00
|
|
|
options: {
|
|
|
|
sourcePath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-10-10 01:44:56 +03:00
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
2019-03-06 08:43:02 +03:00
|
|
|
include: sourcePath,
|
2017-10-10 01:44:56 +03:00
|
|
|
loaders: [
|
2018-03-26 23:56:20 +03:00
|
|
|
'style-loader',
|
|
|
|
'css-loader',
|
2017-10-10 01:44:56 +03:00
|
|
|
{
|
2018-03-26 23:56:20 +03:00
|
|
|
loader: 'postcss-loader',
|
2017-10-10 01:44:56 +03:00
|
|
|
options: {
|
|
|
|
config: {
|
2019-03-06 08:43:02 +03:00
|
|
|
path: require.resolve('../postcss.config.js')
|
|
|
|
}
|
2017-10-10 01:44:56 +03:00
|
|
|
}
|
2019-03-06 08:43:02 +03:00
|
|
|
}
|
|
|
|
]
|
2017-10-10 01:44:56 +03:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
return config
|
2017-08-16 21:28:16 +03:00
|
|
|
}
|