This repository was archived by the owner on Apr 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathwebpack.dev.cjs
More file actions
53 lines (50 loc) · 1.49 KB
/
Copy pathwebpack.dev.cjs
File metadata and controls
53 lines (50 loc) · 1.49 KB
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
const webpack = require("webpack");
const path = require("path");
const fs = require("fs");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const ESLintPlugin = require("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: /\.(js|jsx|ts|tsx)$/, // include .js files
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;
};