-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
66 lines (57 loc) · 1.82 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
63
64
65
66
var webpack = require('webpack'),
ExtractTextPlugin = require('extract-text-webpack-plugin'),
IndexHtmlPlugin = require('indexhtml-webpack-plugin'),
LiveReloadPlugin = require('webpack-livereload-plugin'),
path = require('path');
var autoprefixer = require('autoprefixer');
var cssExtractTextPlugin = new ExtractTextPlugin('[contenthash].css');
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
'script': './scripts/index.js',
'index.html': './index.html',
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json-loader'},
{ test: /\.js[x]?$/, exclude: /(node_modules|bower_components)\//, loader: 'babel-loader'},
{ test: /\.(ttf.*|eot.*|woff.*|ogg|mp3)$/, loader: 'file-loader'},
{ test: /.(png|jpe?g|gif|svg.*)$/, loader: 'file-loader!img-loader?optimizationLevel=7&progressive=true'},
{
test: /\.css$/,
loader: cssExtractTextPlugin.extract('style-loader', 'css-loader!postcss-loader'),
},
{
test: /\.scss$/,
loader: cssExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader'),
},
{
test: /\.html$/,
loader: 'html?attrs=link:href img:src',
},
],
},
postcss: function() {
return [autoprefixer({browsers: "> 3%"})];
},
plugins: [
new CopyWebpackPlugin([
{from: './preview.png'},
{from: './.nojekyll'},
]),
cssExtractTextPlugin,
new IndexHtmlPlugin('index.html', 'index.html'),
new webpack.DefinePlugin({
Environment: JSON.stringify(require('config')),
}),
new LiveReloadPlugin({appendScriptTag:true}),
],
resolve: {
root: path.join(__dirname, 'scripts'),
extensions: ['', '.js', '.json', '.jsx'],
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
},
};