-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
36 lines (35 loc) · 1006 Bytes
/
Copy pathwebpack.config.dev.js
File metadata and controls
36 lines (35 loc) · 1006 Bytes
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
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const merge = require('webpack-merge');
const baseConfig = require('./webpack.config.base');
module.exports = merge(baseConfig, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
port: '9001', // 默认是8080
compress: true, // 是否启用 gzip 压缩
hot: true,
proxy: {
'/api': {
target: 'http://127.0.0.1:7001/',
pathRewrite: {
'^/api': ''
}
}
}
},
output: {
path: path.resolve(__dirname, 'dist'), // 输出目录
filename: '[name].[hash:6].js', // 输出文件名
chunkFilename: '[name].[hash:8].js'
},
plugins: [
new MiniCssExtractPlugin({
filename: 'css/[name].[hash:6].css',
chunkFilename: 'css/[name].[hash:8].css'
}),
new webpack.HotModuleReplacementPlugin() // 热更新插件
]
});