-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathwebpack.dev.mjs
More file actions
56 lines (54 loc) · 1.33 KB
/
webpack.dev.mjs
File metadata and controls
56 lines (54 loc) · 1.33 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
54
55
56
import path from "node:path";
import { fileURLToPath } from "node:url";
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
import DirectoryTreePlugin from "directory-tree-webpack-plugin";
import HTMLPlugin from "html-webpack-plugin";
import { merge } from "webpack-merge";
import {
enhance,
filter,
sort,
} from "./src/utilities/content-tree-enhancers.mjs";
import common from "./webpack.common.mjs";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default (env) =>
merge(common(env), {
experiments: {
lazyCompilation: false,
},
mode: "development",
devtool: "source-map",
entry: {
index: "./index.jsx",
},
plugins: [
new ReactRefreshWebpackPlugin(),
new HTMLPlugin({
template: "index.html",
favicon: "favicon.ico",
}),
new DirectoryTreePlugin({
dir: "src/content",
path: "src/_content.json",
extensions: /\.mdx?/,
enhance,
filter,
sort,
}),
],
devServer: {
static: path.resolve(__dirname, "./dist"),
port: 3000,
hot: true,
compress: true,
historyApiFallback: true,
open: true,
client: {
overlay: {
warnings: false,
errors: true,
},
},
},
});