-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
62 lines (59 loc) · 1.33 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
54
55
56
57
58
59
60
61
62
var path = require('path'),
webpack = require('webpack'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
CleanWebpackPlugin = require('clean-webpack-plugin'),
WebpackCleanupPlugin = require('webpack-cleanup-plugin'),
extractCSS = new ExtractTextPlugin('build.[hash:8].css');
var loaders = [
{
test: /\.css$/,
loader: extractCSS.extract('style', 'css')
},
{
test: /\.html$/,
loader: 'html?interpolate'
},
{
test: /\.(jpe?g|png|gif|webp)$/,
loader: 'file?name=./img/[name].[hash:8].[ext]'
},
{
test: /\.(ttf|eot|woff|woff2)$/,
loader: 'file?name=./font/[hash:8].[ext]'
},
//special loaders
{
test: /.*(reveal.js\\plugin).*$/,
loader: 'file?name=./plugin/[name].[ext]'
},
{
test: /.*(reveal.js\\plugin).*js$/,
loader: 'uglify'
}
];
var plugins = [
//new CleanWebpackPlugin('./build'),
extractCSS,
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src', 'view', 'index.html')
})
];
module.exports = {
entry: path.resolve(__dirname, 'src', 'js', 'index.js'),
output: {
path: path.resolve(__dirname, 'build'),
filename: 'build.[hash:8].js'
},
module: {
loaders: loaders
},
plugins: plugins,
devServer: {
contentBase: path.resolve(__dirname, 'build'),
inline: true,
noInfo: true,
compress: true,
host: '0.0.0.0'
}
}