forked from docschina/webpack.js.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
44 lines (43 loc) · 1.13 KB
/
webpack.dev.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
const path = require('path');
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const HTMLPlugin = require('html-webpack-plugin');
const DirectoryTreePlugin = require('directory-tree-webpack-plugin');
const common = require('./webpack.common.js');
const {
enhance,
filter,
sort,
} = require('./src/utilities/content-tree-enhancers.js');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
module.exports = (env) =>
merge(common(env), {
mode: 'development',
devtool: 'source-map',
entry: {
index: './index.jsx',
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
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,
},
});