-
Notifications
You must be signed in to change notification settings - Fork 29
/
webpack.dev.ts
60 lines (50 loc) · 1.45 KB
/
webpack.dev.ts
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
60
import * as webpack from "webpack";
import * as path from "path";
import fs from "fs";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
import ESLintPlugin from "eslint-webpack-plugin";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf-8"));
module.exports = () => {
const devConfig = {
mode: "development",
devtool: "inline-source-map",
devServer: {
open: true,
client: {
overlay: {
warnings: false,
errors: true,
},
},
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/,
},
],
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
}),
new ESLintPlugin({
emitError: true,
emitWarning: true,
failOnError: false,
failOnWarning: false,
}),
new webpack.DefinePlugin({
VERSION: JSON.stringify(pkg.version + "-d"),
}),
],
};
return devConfig;
};