-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.build.config.js
112 lines (111 loc) · 3.78 KB
/
webpack.build.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
//const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
let FaviconsWebpackPlugin = require('favicons-webpack-plugin');
module.exports = {
entry: {
'auth': ['./src/auth.js'],
'auth_phone': ['./src/auth_phone.js'],
'newpsd': ['./src/newpsd.js'],
'newpsd_phone': ['./src/newpsd_phone.js'],
vendor: ["vue", "whatwg-fetch", "vuelidate", "vue-router"]
},
output: {
path: path.join(__dirname, "dist"),
publicPath: 'https://static.muxixyz.com/muxiauth',
filename: 'static/[name].1.1.3.js'
},
devtool: '#eval-source-map',
module: {
noParse: /vue.runtime.min/,
loaders: [{
test: /\.vue$/,
loader: 'vue-loader'
}, {
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
include: [
path.resolve(__dirname, "src"),
],
}, {
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}, {
test: /\.html$/,
loader: "html-loader"
}, {
test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'url-loader?limit=20&name=/static/[hash:8].[name].[ext]'
}]
},
resolve: {
extensions: ['', '.js', '.scss', '.vue'],
alias: {
'vue': path.resolve(__dirname, 'node_modules/vue/dist/vue.runtime.min'),
'vue-router': path.resolve(__dirname, 'node_modules/vue-router/dist/vue-router.min')
}
},
plugins: [
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/main/base.html',
inject: false,
template: './template/base.ejs',
favicon: './src/pictures/favicon.png',
chunks: ['vendor']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/main/svg.html',
inject: false,
template: './template/svg.ejs'
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/main/header.html',
inject: false,
template: './template/header.ejs'
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/main/auth_phone.html',
inject: false,
template: './template/auth_phone.ejs',
chunks: ['auth_phone']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/main/auth.html',
inject: false,
template: './template/auth.ejs',
chunks: ['auth']
}),
new webpack.optimize.UglifyJsPlugin({
mangle: true,
compress: {
warnings: false,
},
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/main/newpsd.html',
inject: false,
template: './template/newpsd.ejs',
chunks: ['newpsd']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/main/newpsd_phone.html',
inject: false,
template: './template/newpsd_phone.ejs',
chunks: ['newpsd_phone']
}),
new HtmlWebpackHarddiskPlugin(),
new FaviconsWebpackPlugin('./src/pictures/favicon.png'),
new webpack.optimize.CommonsChunkPlugin({name:"vendor", filename:"static/vendor.1.10.3.js"}),
]
};