1
1
mirror of https://github.com/primer/css.git synced 2024-12-15 15:34:02 +03:00
css/.storybook/webpack.config.js
2019-03-05 21:43:02 -08:00

47 lines
938 B
JavaScript

const {resolve} = require('path')
const sourcePath = resolve(__dirname, '../src')
module.exports = ({config, mode}) => {
const babel = config.module.rules.find(rule => {
return rule.test.test('test.js')
}).use[0]
config.module.rules = config.module.rules.filter(rule => {
return !rule.test.test('test.md')
})
config.module.rules.push(
{
test: /\.md$/,
include: sourcePath,
loaders: [
babel,
{
loader: require.resolve('./lib/storiesFromMarkdown'),
options: {
sourcePath
}
}
]
},
{
test: /\.scss$/,
include: sourcePath,
loaders: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
config: {
path: require.resolve('../postcss.config.js')
}
}
}
]
}
)
return config
}