-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-common.config.js
42 lines (41 loc) · 1.48 KB
/
webpack-common.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
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
loaders: [
// image loader - https://www.npmjs.com/package/image-webpack-loader
{
test: /\.(jpe?g|png|gif|svg|ico)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
},
// javascript/jsx loader - https://www.npmjs.com/package/babel-loader
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel-loader?stage=0&optional=runtime'],
},
// styles
{
test: /\.[s]?css$/,
loader: "style!css!autoprefixer-loader?browsers=last 2 version!sass"
},
// and font files - embed them if possible
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/font-woff"
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/font-woff2"
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&minetype=application/octet-stream"
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file"
}
],
// https://www.npmjs.com/package/html-webpack-plugin - generate our html file from a template - makes it easier to include custom stuff
indexPagePlugin: new HtmlWebpackPlugin({
inject: true,
title: 'webpack starter template 123',
filename: 'index.html',
template: './app/index_template.html'
})
}