2018-03-26 23:56:20 +03:00
|
|
|
const path = require('path');
|
2017-08-18 02:25:33 +03:00
|
|
|
|
2018-03-26 23:56:20 +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')
|
|
|
|
}
|
|
|
|
|
2018-03-26 23:56:20 +03:00
|
|
|
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)
|
2018-03-26 23:56:20 +03:00
|
|
|
rules.splice(index, 1, {
|
|
|
|
test: /\.md$/,
|
|
|
|
loader: 'raw-loader',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
rules.push(
|
2017-10-10 01:44:56 +03:00
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
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: {
|
2018-03-26 23:56:20 +03:00
|
|
|
path: require.resolve('./postcss.config.js'),
|
2017-08-18 02:25:33 +03:00
|
|
|
},
|
|
|
|
},
|
2017-10-10 01:44:56 +03:00
|
|
|
},
|
|
|
|
{
|
2018-03-26 23:56:20 +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
|
|
|
}
|