-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config03.js
30 lines (29 loc) · 1009 Bytes
/
webpack.config03.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const serviceMockMiddleware = require('../middleware');
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, 'src', 'demo03', 'index.js'),
output: {
filename: '[name].[hash].js',
path: path.resolve(__dirname, 'dist')
},
devtool: 'inline-source-map',
devServer: {
/**
* 提供在服务器内部所有其他中间件之前执行自定义中间件的能力。
* @param app
* @param server
*/
before(app, server) {
// 使用mock中间件
app.use(serviceMockMiddleware({ webpackConfig: module.exports, server }));
}
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname,'src/common/index.html'), // html模版
filename: path.resolve(__dirname, 'dist', 'index.html'), // html输出位置
})
]
}