-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
57 lines (55 loc) · 1.38 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
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const config = require('getconfig')
const _ = require('lodash')
const { isDev } = config.getconfig
const CLIENT_CONFIG_KEYS = ['region']
module.exports = {
output: {
publicPath: '/'
},
entry: {
app: ['./app/index.js', isDev && 'webpack-hot-middleware/client'].filter(
Boolean
)
},
mode: isDev ? 'development' : 'production',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpe?g|gif|svg|ttf|eot|woff)(\?.*)?$/,
exclude: /node_modules/,
loader: 'url-loader',
options: {
limit: 0,
name: '[hash]-[name].[ext]'
}
}
]
},
plugins: [
isDev && new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
title: 'Friends from the Trail Heroku Demo',
template: 'app/index.html',
favicon: 'app/images/favicon.ico'
}),
new webpack.DefinePlugin({
'process.env.SELFIES_APP_REPO_URL': JSON.stringify(process.env.SELFIES_APP_REPO_URL),
'process.env.CLIENT_CONFIG': JSON.stringify(
_.pick(config, ...CLIENT_CONFIG_KEYS)
)
})
].filter(Boolean)
}