forked from webpack/webpack.js.org
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.dev.mjs
48 lines (47 loc) · 1.2 KB
/
webpack.dev.mjs
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
import path from 'path';
import { merge } from 'webpack-merge';
import HTMLPlugin from 'html-webpack-plugin';
import DirectoryTreePlugin from 'directory-tree-webpack-plugin';
import common from './webpack.common.mjs';
import {
enhance,
filter,
sort,
} from './src/utilities/content-tree-enhancers.mjs';
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
import { fileURLToPath } from 'url';
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,
},
});