forked from globocom/megadraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakewebpackconfig.js
More file actions
51 lines (47 loc) · 1009 Bytes
/
makewebpackconfig.js
File metadata and controls
51 lines (47 loc) · 1009 Bytes
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
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const defaultConfig = {
entry: [
"./website/index.js"
],
output: {
path: __dirname + "/website/",
publicPath: "/",
filename: "./bundle.js"
},
devtool: "source-map",
resolve: {
modules: [
path.join(__dirname, "src"),
"node_modules"
]
},
module: {
rules: [
{
exclude: /node_modules/,
loader: "babel-loader",
},
{
test: /\.md$/,
loader: "raw-loader"
},
{
test: /\.html$/,
loader: "html-loader",
}
]
},
plugins: [
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
filename: __dirname + "/website/index.html",
template: __dirname + "/website/index_tpl.html",
}),
]
};
function makeConfig (extra) {
const config = Object.assign(true, defaultConfig, extra || {});
return config;
}
module.exports = makeConfig;