forked from globocom/megadraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makewebpackconfig.js
49 lines (45 loc) · 874 Bytes
/
makewebpackconfig.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
const merge = require("merge");
const path = require("path");
const defaultConfig = {
entry: [
"./website/index.js"
],
output: {
path: __dirname,
publicPath: "/",
filename: "./website/bundle.js"
},
devtool: "source-map",
devServer: {
inline: true,
contentBase: "./"
},
resolve: {
extensions: ["", ".js", ".jsx"],
fallback: path.join(__dirname, "node_modules")
},
resolveLoader: {
root: path.join(__dirname, "node_modules")
},
module: {
loaders: [
{
exclude: /node_modules/,
loader: "babel"
},
{
test: /\.md$/,
loader: "raw"
},
{
test: /\.json$/,
loader: "json"
}
]
}
};
function makeConfig (extra) {
const config = merge.recursive(true, defaultConfig, extra || {});
return config;
}
module.exports = makeConfig;