2018-12-11 09:47:44 +03:00
|
|
|
export default function (config, env, helpers) {
|
|
|
|
const postcssLoader = helpers.getLoadersByName(config, 'postcss-loader');
|
|
|
|
const cssLoader = helpers.getLoadersByName(config, 'css-loader');
|
2019-05-07 11:29:07 +03:00
|
|
|
postcssLoader.forEach(({loader}) => (delete loader.options));
|
|
|
|
cssLoader.forEach(({loader}) => (delete loader.options));
|
2018-12-11 09:47:44 +03:00
|
|
|
|
2019-05-07 11:29:07 +03:00
|
|
|
helpers.getRulesByMatchingFile(config, '*.css').forEach(({rule}) => {
|
2018-12-11 09:47:44 +03:00
|
|
|
let filter = (rule.include || rule.exclude || []);
|
|
|
|
let newFilter = filter[0].replace('/components', '/styles');
|
|
|
|
filter.push(newFilter);
|
|
|
|
});
|
|
|
|
|
|
|
|
if (env.production) {
|
2019-05-07 15:26:58 +03:00
|
|
|
config.output.publicPath = '';
|
2018-12-11 09:47:44 +03:00
|
|
|
} else {
|
|
|
|
config.output.publicPath = 'http://localhost:8080/';
|
|
|
|
}
|
|
|
|
config.devServer = {
|
|
|
|
quiet: true,
|
|
|
|
headers: {
|
2019-05-07 11:29:07 +03:00
|
|
|
'Access-Control-Allow-Origin': '*',
|
|
|
|
'Access-Control-Allow-Methods': '*',
|
|
|
|
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
|
2018-12-11 09:47:44 +03:00
|
|
|
}
|
2019-05-07 11:29:07 +03:00
|
|
|
};
|
2018-12-11 09:47:44 +03:00
|
|
|
}
|