-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
44 lines (43 loc) · 1.11 KB
/
webpack.prod.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
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
const merge = require('webpack-merge');
const common = require('./webpack.common');
module.exports = merge.smart(common, {
entry: [
'./app/index.js',
'./scss/main.scss'
],
module: {
rules: [
// Pipe other styles through css modules and append to style.css
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: {
loader: 'css-loader',
},
}),
},
// Add SASS support - compile all other .scss files and pipe it to style.css
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
use: [
{ loader: 'css-loader' },
{ loader: 'sass-loader' },
],
}),
},
],
},
plugins: [
new UglifyJSPlugin({
sourceMap: true
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
}),
new ExtractTextPlugin('style.css')
]
});