-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
105 lines (87 loc) · 2.06 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
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
95
96
97
98
99
100
101
102
103
104
105
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'dist/');
var APP_DIR = path.resolve(__dirname, 'src');
const commonConfig = {
resolve: { extensions: ['.js', '.jsx'] },
externals: { /*"jquery": "jQuery"*/ },
plugins: [
],
//devtool: "inline-source-map",
//devtool: "inline-eval-cheap-source-map",
cache: true,
module: {
rules: [
{
enforce: "pre",
test: /\.js$/,
}
]
}
}
var config_server = {
name : "serverConfig",
...commonConfig,
entry: __dirname + '/server.js',
output: {
filename: 'server.bundle.js',
path: BUILD_DIR,
publicPath: "/"
},
resolve: {
extensions: ['.js', '.json']
},
node: {
console: false,
fs: 'empty',
net: 'empty',
tls: 'empty',
__dirname : false
},
target: 'node'
}
var config_client = {
entry: APP_DIR + '/index.js',
output: {
path: BUILD_DIR,
filename: 'bundle.js',
publicPath: "/"
},
resolve: {
extensions: ['.js', '.json']
},
node : {
console: false,
fs: 'empty',
net: 'empty',
tls: 'empty'
},
module : {
loaders : [
{
test : /\.jsx?$/,
include : APP_DIR,
loader : 'babel-loader'
},
{test: /\.css$/, loader: "style-loader!css-loader" },
{test: /\.html$/,
exclude: /node_modules/,
loader: 'html-loader'},
{ test: /\.png$/, loader: "url-loader"},
{ test: /\.jpg$/, loader: "url-loader"},
{ test: /\.gif$/, loader: "url-loader"},
{ test: /\.json$/, loader: 'json-loader' },
{
test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
// Limiting the size of the woff fonts breaks font-awesome ONLY for the extract text plugin
// loader: "url?limit=10000"
use: "url-loader"
},
{
test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
use: 'file-loader'
},
]
},
};
module.exports = [config_client, config_server];