-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
59 lines (55 loc) · 1.18 KB
/
webpack.config.babel.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
"use strict";
import dotenv from "dotenv";
import path from "path";
import HtmlWebpackPlugin from "html-webpack-plugin";
import CleanWebpackPlugin from "clean-webpack-plugin";
import validate from "webpack-validator";
dotenv.config();
const PATHS = {
app: path.join(__dirname, "app"),
data: path.join(__dirname, "data"),
build: path.join(__dirname, "public")
};
const config = {
entry: {
app: PATHS.app
},
output: {
path: PATHS.build,
filename: "[name].js"
},
plugins: [
new CleanWebpackPlugin([PATHS.build], {
root: process.cwd()
}),
new HtmlWebpackPlugin({
title: "Quartermaster Journal",
template: "./app/index.html.template"
})
],
resolve: {
extensions: ["", ".js", ".jsx"]
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
loaders: ["babel?cacheDirectory"],
include: PATHS.app
},
{
test: /\.json$/,
loaders: ["json"],
include: PATHS.data
}
]
},
devtool: "eval-source-map",
devServer: {
historyApiFallback: true,
stats: "errors-only",
host: process.env.HOST,
port: process.env.PORT
}
};
module.exports = validate(config);