-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.client.dev.config.js
93 lines (91 loc) · 2.04 KB
/
webpack.client.dev.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
/* eslint-disable */
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const port = process.env.PORT || 4000;
module.exports = {
mode: 'development',
entry: [
'@babel/polyfill',
'./src/index.jsx'
],
output: {
path: path.resolve(__dirname,'dist'),
filename: 'app.dev.js',
publicPath: '/',
},
module: {
rules: [
{
test: /\.jsx?$/,
use: {
loader: 'babel-loader',
},
exclude: ['/node_modules', '/config'],
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
],
},
{
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
'sass-loader',
],
},
{
test: /\.(ico|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader',
options: {
name: '[hash].[ext]',
limit: 10000,
},
},
],
},
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
}),
new webpack.EnvironmentPlugin({
NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined
DEBUG: false,
}),
new HtmlWebpackPlugin({
template: './public/index.html',
favicon: './public/favicon.ico',
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.BROWSER': JSON.stringify(true),
}),
],
optimization: {},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.json', '.jsx', '.css'],
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
host: 'localhost',
port,
historyApiFallback: true,
open: true,
hot: true,
proxy: {
'/api': {
target: 'http://localhost:3000',
},
'/socket.io': {
target: 'http://localhost:3000',
ws: true,
},
},
},
};