-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack-dev.config.js
46 lines (39 loc) · 1.09 KB
/
webpack-dev.config.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
45
46
/**
* webpack-dev.config.js
* @author wangbo
* @since 2020/3/10
* @github https://github.com/BoWang816
*/
const path = require('path');
const genRules = require('./webpack-loader.config');
const buildPath = path.join(__dirname, '/');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const config = {
mode: 'development',
// map
// http://www.css88.com/doc/webpack2/configuration/devtool/
devtool: 'cheap-eval-source-map',
// 入口文件配置
context: path.join(__dirname, "src/"),
// 入口文件配置
entry: {
js: './demo/app.js'
},
// 文件导出的配置
output:{
// path: '/' ,
filename: "./app.js",
// publicPath 对于热替换(HMR)是必须的,让webpack知道在哪里载入热更新的模块(chunk)
publicPath: "/"
},
// 处理项目中的不同类型的模块
module: {
rules: genRules('src', true)
},
// 以插件形式定制webpack构建过程
plugins: [
// 删除dist目录
new CleanWebpackPlugin()
],
};
module.exports = config;