-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
37 lines (36 loc) · 1.37 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
const webpack = require('webpack');
const path = require("path");
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
index: './src/js/index.js',
contact: './src/js/contact.js'
},
output: {path: __dirname + '/dist', filename: '[name].bundle.js'},
module: {
loaders: [
{test: /\.css$/, loader: 'style-loader!css-loader!postcss-loader'},
{test: /\.(jpe?g|png|gif|svg)$/i, loader: ["file-loader?name=assets/[path][name].[ext]", 'image-webpack-loader']},
{test: /\.hbs$/, loader: 'handlebars-loader', options:{helperDirs: path.resolve(__dirname, "./src/partials/helpers")}}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendors'),
new UglifyJSPlugin({mangle: {except: ['$super', '$', 'exports', 'require']}}),
new HtmlWebpackPlugin({
filename: 'index.html',
chunks: ['index', 'vendors'],
minify: {collapseWhitespace: true},
hash: true,
template: './src/index.html'
}),
new HtmlWebpackPlugin({
filename: 'contact.html',
chunks: ['contact', 'vendors'],
minify: {collapseWhitespace: true},
hash: true,
template: './src/contact.html'
})
]
};