-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
66 lines (58 loc) · 1.69 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
var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var APP_JS_DIR = path.resolve(__dirname, 'src/app/js');
var APP_CSS_DIR = path.resolve(__dirname, 'src/contents/css');
var BUILD_JS_DIR = path.resolve(__dirname, 'src/client/js');
var BUILD_CSS_DIR = path.resolve(__dirname, 'src/client/css');
var BUILD_GRADLE_JS_DIR = path.resolve(__dirname, 'src/main/resources/static/js');
var BUILD_GRADLE_CSS_DIR = path.resolve(__dirname, 'src/main/resources/static/css');
var AUTH_JS_DR = path.resolve(__dirname, 'src/auth/js');
var glob = require("glob");
var APP_ALL_JS_FILES = glob.sync('./src/contents/js/**/*.js');
/*
* Webpack Config
*/
var config = {
entry: {
"bundle": APP_JS_DIR + '/index.jsx',
"bundle.min": APP_JS_DIR + '/index.jsx',
"authBundle": AUTH_JS_DR + '/index.jsx',
"authBundle.min": AUTH_JS_DR + '/index.jsx',
"common": glob.sync('./src/contents/js/**/*.js'),
"common.min": glob.sync('./src/contents/js/**/*.js')
},
devtool: 'source-map',
output: {
path: BUILD_GRADLE_JS_DIR,
filename: "[name].js"
},
module : {
loaders : [
{
test : /\.jsx?/,
loader : 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('css-loader!sass-loader')
}
]
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new ExtractTextPlugin({
filename: '../css/style.css',
allChunks: true
}),
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true
})
]
};
module.exports = config;