-
Notifications
You must be signed in to change notification settings - Fork 219
/
makewebpackconfig.js
47 lines (43 loc) · 1 KB
/
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
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const defaultConfig = {
mode: process.env.NODE_ENV || "production",
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;