-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
99 lines (98 loc) · 2.61 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const config = require('./env.config.js');
module.exports = {
devtool: '#cheap-module-eval-source-map',
context: path.resolve(__dirname, 'src'),
entry: [
'webpack-dev-server/client?http://0.0.0.0:8080',
'./js/index.jsx',
'./styles/main.scss'
],
output: {
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: ['.js', '.jsx'],
modules: ['node_modules']
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: ['react-hot-loader', 'babel-loader?presets[]=es2015,presets[]=react']
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: ['style-loader', { loader: 'css-loader', options: { minimize: true } }, { loader: 'postcss-loader', options: { config: { path: './postcss.config.js' } } }, 'sass-loader']
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader?hash=sha512&digest=hex&name=[path][name]-[hash].[ext]',
{
loader: 'image-webpack-loader',
query: {
progressive: true,
gifsicle: {
interlaced: false,
colors: 256,
optimizationLevel: 3,
},
optipng: {
interlaced: false,
optimizationLevel: 7,
},
pngquant: {
quality: '65-90',
speed: 4
}
}
}
]
},
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development'),
'TWITCH_CLIENT_ID': JSON.stringify(config.TWITCH_CLIENT_ID || 'NO ID')
}
}),
new HtmlWebpackPlugin({
template: './index.html',
minify: {},
chunks: []
}),
new FaviconsWebpackPlugin({
logo: './img/favicon.png',
prefix: 'icons/',
icons: {
android: true,
appleIcon: true,
appleStartup: false,
coast: false,
favicons: true,
firefox: true,
opengraph: true,
twitter: true,
yandex: false,
windows: true
}
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
host: '0.0.0.0',
port: 8080,
historyApiFallback: true
}
};