-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
54 lines (48 loc) · 1.6 KB
/
webpack.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
47
48
49
50
51
52
53
//依赖
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
//配置文件
const moduleConfig = require('./webpack_config/module.config.js');
const pluginsConfig = require('./webpack_config/plugins.config.js');
const apiConfig = require('./webpack_config/api.config.js');
module.exports = {
devtool: apiConfig.devtool,
entry: apiConfig.entry,
output: {
path: path.resolve(__dirname, 'output'),
filename: apiConfig.outputFilename,
chunkFilename: 'js/chunk/[name].js?v=[chunkHash]'
},
module: moduleConfig ,
plugins: pluginsConfig,
devServer: {
contentBase: path.resolve(__dirname, './app/'), //服务器根路径
proxy: {
'/api': {// '/api':匹配项
target: 'http://112.126.91.237',// 接口的域名
changeOrigin: true,// 如果接口跨域,需要进行这个参数配置
}
},
hot:false,
inline:false,
disableHostCheck: apiConfig.disableHostCheck,
host: apiConfig.host, //ip
compress: true, // 服务端压缩
port: apiConfig.port // 端口
},
optimization:{
splitChunks:{
cacheGroups:{
vendor:{
test: /node_modules\/(.*)\.js/,
chunks:'all',
name:'vendor',
enforce:true
}
}
}
}
}