This repository has been archived by the owner on May 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.js
59 lines (53 loc) · 1.6 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
var webpack = require('webpack');
var path = require('path');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var BUILD_DIR = path.resolve(__dirname, 'dist');
var APP_DIR = path.resolve(__dirname, 'src/client/app');
const debug = true
var config = {
entry: APP_DIR + '/index.jsx',
devtool: debug ? '#source-map' : false,
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.css$/,
use: ['style-loader', 'css-loader?modules'],
}, {
test: /\.jsx?/,
include:
APP_DIR,
use: 'babel-loader'
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.iinterlaced=false'
]
}
]
},
devServer: {
/* Send API requests on localhost to API server get around CORS */
proxy: {
'/fn': {
target: 'http://localhost:8080/',
pathRewrite: {"^/fn": ""}
},
'/completer': {
target: 'http://localhost:8081/',
pathRewrite: {"^/completer": ""},
},
}
},
plugins: [
new CopyWebpackPlugin([
{from: 'src/client/app/background.png'},
{from: 'src/client/app/app.css'},
{from: 'node_modules/bootstrap3/dist', to:'bootstrap'},
])]
};
module.exports = config;