-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
82 lines (80 loc) · 1.95 KB
/
webpack.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const autoprefixer = require('autoprefixer')
const config = {
devtool: 'source-map',
entry: [
'./src/index'
],
output: {
path: path.join(__dirname, 'public'),
filename: 'app-[hash].min.js'
},
plugins: [
/**
* PRODUCTION
*/
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
/**
* COMMON
*/
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new HtmlWebpackPlugin({
title: 'react-redux-bootstrap4',
filename: 'index.html',
template: 'index.template.html',
favicon: path.join(__dirname, 'public/favicon.ico')
}),
new ExtractTextPlugin('style-[hash].css')
],
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel'],
exclude: /node_modules/,
include: path.join(__dirname, 'src')
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass', 'postcss']
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader', 'sass-loader')
},
{
test: /\.json$/,
exclude: /node_modules/,
loader: 'json'
},
{
test: /\.(woff|woff2|eot|ttf)$/i,
loader: 'file-loader?name=fonts/[name]-[hash].[ext]'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'file-loader?name=images/[name]-[hash].[ext]'
}
]
},
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
'bootstrap-css': path.join(__dirname, 'node_modules/bootstrap/dist/css/bootstrap.min.css')
}
},
postcss: [
autoprefixer({ browsers: ['last 2 versions'] })
]
}
module.exports = config