-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.config.js
149 lines (148 loc) · 5.14 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
let FaviconsWebpackPlugin = require('favicons-webpack-plugin');
module.exports = {
entry: {
'main.js': ['./src/main.js', 'webpack-hot-middleware/client', "./src/header.js"],
'second.js': ['./src/second.js', 'webpack-hot-middleware/client', "./src/header.js"],
'pictures.js': ['./src/pictures.js', 'webpack-hot-middleware/client', "./src/header.js"],
'profile.js': ['./src/profile.js', 'webpack-hot-middleware/client'],
'landing.js': ['./src/landing.js', 'webpack-hot-middleware/client', "./src/header.js"],
'wrong.js': ['./src/wrong.js', 'webpack-hot-middleware/client', "./src/header.js"],
'search.js': ['./src/search.js', 'webpack-hot-middleware/client', "./src/header.js"],
'special.js': ['./src/special.js', 'webpack-hot-middleware/client', "./src/header.js"],
vendor: ["vue", "whatwg-fetch", "./src/style.js"]
},
output: {
path: path.join(__dirname, ""),
publicPath: '/dist/',
filename: '[name]'
},
vue: {
cssModules: {
// overwrite local ident name
localIdentName: '[path][name]---[local]---[hash:base64:5]',
// enable camelCase
camelCase: true
}
},
module: {
resolveLoader: {
root: path.join(__dirname, "node_modules")
},
loaders: [{
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
include: [
path.resolve(__dirname, "src"),
],
}, {
test: /\.(html|tpl)$/,
loader: 'html-loader'
}, {
test: /\.(png|jpg|gif|svg)$/,
loader: 'url-loader?limit=20&name=images/[hash:8].[name].[ext]'
}, {
test: /\.scss$/,
loader: 'style!css!sass'
}]
},
devtool: '#eval-source-map',
resolve: {
extensions: ['', '.js', '.scss', '.vue'],
alias: {
'vue': path.resolve(__dirname, 'node_modules/vue/dist/vue.runtime.min'),
}
},
plugins: [
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/base.html',
inject: false,
template: './template/base.ejs',
chunks: ['vendor']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/index.html',
inject: false,
template: './template/index.ejs',
chunks: ['main.js']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/header.html',
inject: false,
template: './template/header.ejs'
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/pictures.html',
inject: false,
template: './template/pictures.ejs',
chunks: ['pictures.js']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/second.html',
inject: false,
template: './template/second.ejs',
chunks: ['second.js']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/profile.html',
inject: false,
template: './template/profile.ejs',
chunks: ['profile.js']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/landing.html',
inject: false,
template: './template/landing.ejs',
chunks: ['landing.js']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/wrong.html',
inject: false,
template: './template/wrong.ejs',
chunks: ['wrong.js']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/special.html',
inject: false,
template: './template/special.ejs',
chunks: ['special.js']
}),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: 'template/search.html',
inject: false,
template: './template/search.ejs',
chunks: ['search.js']
}),
new HtmlWebpackHarddiskPlugin(),
// new FaviconsWebpackPlugin('./src/img/1.png'),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.UglifyJsPlugin({
mangle: true,
compress: {
warnings: false,
},
}),
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.bundle.js")
]
};