forked from docschina/webpack.js.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
43 lines (42 loc) · 1.12 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
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 HTMLTemplate = require('html-webpack-template');
const common = require('./webpack.common.js');
const { enhance, filter, sort } = require('./src/utilities/content-tree-enhancers.js');
module.exports = env => merge(common(env), {
mode: 'development',
devtool: 'source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HTMLPlugin({
inject: false,
template: HTMLTemplate,
title: 'webpack',
appMountId: 'root',
mobile: true,
favicon: './favicon.ico',
meta: {
description: '...'
}
}),
new DirectoryTreePlugin({
dir: 'src/content',
path: 'src/_content.json',
extensions: /\.mdx?/,
enhance,
filter,
sort
})
],
devServer: {
contentBase: path.resolve(__dirname, './dist'),
port: 3000,
hot: true,
inline: true,
compress: true,
historyApiFallback: true
}
});