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

47 lines
921 B
JavaScript
Raw Normal View History

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')
})
2019-03-06 08:43:02 +03:00
config.module.rules.push(
{
test: /\.md$/,
include: sourcePath,
loaders: [
babel,
{
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: [
'style-loader',
'css-loader',
2017-10-10 01:44:56 +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
}