-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
57 lines (52 loc) · 1.17 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
const { resolve } = require("path");
const webpack = require("webpack");
const publicFolder = resolve("./public");
module.exports = (env) => {
const devMode = Boolean(env.WEBPACK_SERVE);
const loaderConfig = {
loader: "elm-webpack-loader",
options: {
debug: false,
optimize: !devMode,
cwd: __dirname,
},
};
const elmLoader = devMode
? [{ loader: "elm-reloader" }, loaderConfig]
: [loaderConfig];
return {
mode: devMode ? "development" : "production",
entry: "./src/index.ts",
output: {
publicPath: "/",
path: publicFolder,
filename: "bundle.js",
},
stats: devMode ? "errors-warnings" : "normal",
infrastructureLogging: {
level: "warn",
},
devServer: {
port: 8000,
hot: "only",
},
module: {
rules: [
{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
use: elmLoader,
},
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".ts", ".js"],
},
plugins: [new webpack.NoEmitOnErrorsPlugin()],
};
};