1
1
mirror of https://github.com/primer/css.git synced 2024-11-30 01:04:04 +03:00
css/.storybook/webpack.config.js

53 lines
1.0 KiB
JavaScript
Raw Normal View History

const path = require('path');
2017-08-18 02:25:33 +03:00
const modulesPath = path.resolve(__dirname, '../modules')
2017-08-16 21:28:16 +03:00
2017-10-10 01:44:56 +03:00
module.exports = (config, env) => {
if (env === 'PRODUCTION') {
config.plugins = config.plugins
.filter(plugin => plugin.constructor.name !== 'UglifyJsPlugin')
}
const rules = config.module.rules
rules.forEach((rule, index) => {
if ('README.md'.match(rule.test)) {
2018-03-27 00:01:55 +03:00
// console.warn('replacing MD rule:', rule)
rules.splice(index, 1, {
test: /\.md$/,
loader: 'raw-loader',
})
}
})
rules.push(
2017-10-10 01:44:56 +03:00
{
test: /\.scss$/,
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: {
path: require.resolve('./postcss.config.js'),
2017-08-18 02:25:33 +03:00
},
},
2017-10-10 01:44:56 +03:00
},
{
loader: 'sass-loader',
2017-10-10 01:44:56 +03:00
options: {
includePaths: [
modulesPath,
],
}
},
],
include: modulesPath,
}
)
return config
2017-08-16 21:28:16 +03:00
}