forked from pythonbrasil/pybr2018-site
-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.production.config.js
50 lines (49 loc) · 1.36 KB
/
webpack.production.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const webpack = require('webpack');
const CnameWebpackPlugin = require('cname-webpack-plugin');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const devtool = 'source-map';
const autoprefixer = require('autoprefixer');
const config = require('./webpack.config.js');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const resolve = config.resolve;
const rules = config.module.rules;
rules.find(
rule => String(rule.test) === String(/\.scss$/)
).loader = ExtractTextPlugin.extract([
'css-loader?minimize',
{
loader: 'postcss-loader',
options: {
plugins: () => [require('autoprefixer')],
}
},
{
loader: 'sass-loader',
options: {
includePaths: [path.resolve(__dirname, 'node_modules')],
}
}
])
module.exports = {
entry: config.entry,
output: config.output,
resolve: resolve,
devtool: devtool,
module: {
rules: rules
},
plugins: config.plugins.concat([
new ExtractTextPlugin("styles.css"),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: devtool && (devtool.indexOf('sourcemap') >= 0 || devtool.indexOf('source-map') >= 0)
}),
new CnameWebpackPlugin({
domain: 'pythonsul.org',
}),
])
}