-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
81 lines (80 loc) · 1.88 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
/**
* This file represents the basic configuration that we will run to get our
* bundle generated. It doesn't do anything by itself, but instead, returns a
* function that takes an option parameter.
*
* Any changes/additions to this configuration should come in through the option
* paramater.
*/
const path = require('path');
module.exports = {
cache: true,
entry: {
app: [
'react-hot-loader/patch',
path.join(__dirname, 'src/index.js'),
],
},
devtool: 'eval',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: 'babel-loader',
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
use: [
{
loader: 'file-loader',
options: {
hash: 'sha512',
digest: 'hex',
name: '[name]-[hash].[ext]',
},
},
{
loader: 'image-webpack-loader',
options: {
bypassOnDebug: true,
gifsicle: {
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
},
},
],
},
],
},
resolve: {
extensions: ['.webpack.js', '.js', '.json', '.jsx'],
modules: [
'node_modules',
],
},
plugins: [],
output: {
path: path.join(__dirname, 'public/bundle'),
publicPath: 'http://webpack:8080/',
filename: '[name].bundle.js',
sourceMapFilename: '[file].map',
},
devServer: {
publicPath: '/',
public: 'webpack:8080',
host: 'webpack',
port: 8080,
watchOptions: {
poll: 1000,
},
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
},
},
};