-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
58 lines (51 loc) · 1.42 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
'use strict';
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
// Application entrypoint
entry: ['./js/index'],
output: {
path: path.resolve('docs/'), // directory where bundle will go
publicPath: '/', // where dev server will serve bundle from
filename: 'bundle-[hash].js' // rev the bundle for cache busting
},
plugins: [
// generate a rev'd css file
new ExtractTextPlugin('styles-[hash].css'),
// generate index.html with rev'd assets injected
new HtmlWebpackPlugin({
template: 'index.template.ejs',
inject: 'body',
})
],
module: {
loaders: [
// javascript
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015']
}
},
// sass
{
test: /\.scss$/,
exclude: /node_modules/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap!sass-loader?sourceMap')
},
// media, DataUrl if file is smaller than 15kb
{
test: /\.(png|jpg|mp3)$/,
exclude: /node_modules/,
loader: 'url-loader?limit=15000'
}
]
},
// specify what kind of files can be loaded without having to specify their extensions
resolve: {
extensions: ['', '.js', '.es6']
}
};