-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
44 lines (41 loc) · 927 Bytes
/
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
import webpack from "webpack";
import nodeExternals from "webpack-node-externals";
import dotenv from "dotenv-webpack";
import path from "path";
import { Utils } from "./src/helpers";
let config = {
target: "node",
mode: process.env.NODE_ENV,
entry: {
server: "./index.js"
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js"
},
resolve: {
extensions: [".js"],
alias: {
"@": path.resolve(__dirname, "./src"),
"@root": path.resolve(__dirname, ".")
}
},
externals: [nodeExternals()],
plugins: [
new dotenv({
path: path.resolve(
__dirname,
Utils.env.isProd ? "./.env" : "./.env.development"
)
})
],
stats: {
all: false,
timings: true
}
};
if (Utils.env.isDev) {
config.devtool = "cheap-module-eval-source-map";
config.plugins.push(new webpack.HotModuleReplacementPlugin());
}
export default config;