-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
64 lines (53 loc) · 1.52 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
const path = require('path');
const merge = require('webpack-merge');
const TARGET = process.env.npm_lifecycle_event;
const PATHS = {
output: path.join(__dirname, './target/classes/static')
};
var common = {
entry: "./src/main/React/index.jsx",
output: {
path: PATHS.output,
publicPath: '',
filename: 'bundle.js'
},
resolve: {
modulesDirectories: ['node_modules', './src/main/React'],
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [{
test: /\.js/,
exclude: /node_modules/,
loader: "babel",
include: __dirname,
query: {
presets: ["es2015", "react"]
}
}]
}
}
if (TARGET === 'start') {
console.log('Compiling front end code for dev ')
// Add Hot reload for dev env
common.module.loaders[0].query.presets.push("react-hmre")
module.exports = merge(common, {
devServer: {
port: 9090,
proxy: {
'/': {
target: 'http://localhost:8080',
secure: false,
prependPath: false
}
},
publicPath: 'http://localhost:9090/',
historyApiFallback: true
},
devtool: 'source-map'
});
}
if (!TARGET) {
console.log('Compiling front end code for production ')
module.exports = merge(common, {});
}