-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-proxy-server.config.js
94 lines (89 loc) · 2.26 KB
/
webpack-proxy-server.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
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const webpack = require('webpack');
const path = require('path');
const MainStylesExtract = new ExtractTextPlugin('assets/main.css');
const VendorStylesExtract = new ExtractTextPlugin('assets/vendor.css');
const target = process.env.NODE_ENV || 'develop';
let config = {
context: path.resolve(__dirname, 'client'),
entry: {
customers: './customers/src/app.js'
},
output: {
path: __dirname + '/client',
filename: '[name]/dist/bundle.js',
publicPath: '/dist/'
},
module: {
rules: [
{
test:/\.js$/,
exclude:[path.resolve(__dirname, 'node_modules')],
loader: 'babel-loader',
query: {
presets: ['es2015']
}
},
{
test: /\.css$/,
use: MainStylesExtract.extract({
fallback: "style-loader",
use: "css-loader?url=false",
})
},
{
test: /\.less$/,
use: VendorStylesExtract.extract({
fallback: "style-loader",
use: "css-loader!less-loader"
})
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'file-loader?emitFile=false&name=fonts/[name].[ext]'
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.json', '.css'],
modules: [
path.resolve(__dirname, 'node_modules')
],
alias: {
jquery$:path.resolve( __dirname,'node_modules/jquery/src/jquery.js'),
moment$:path.resolve( __dirname,'node_modules/moment/moment.js'),
bootstrapcss$: path.resolve( __dirname,'node_modules/bootstrap/dist/css/bootstrap.css'),
npm: __dirname + '/node_modules',
b: __dirname + '/client/lib'
}
},
plugins: [
MainStylesExtract,
VendorStylesExtract
],
devtool: 'source-map',
devServer: {
hot: true,
contentBase: "client",
// https: true,
proxy: {
'/api': {
secure: false,
target: 'http://localhost:3000'
},
'/sendtoken': {
secure: false,
target:'http://localhost:3000'
},
'/sockjs-node/*': {
secure: false,
target:'http://localhost:3000'
},
'/socket.io/*': {
secure:false,
target:'http://localhost:3000'
}
}
}
};
module.exports = config;