-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
78 lines (73 loc) · 1.58 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
67
68
69
70
71
72
73
74
75
76
77
78
/**
* Created by tiberiu on 27/07/16.
*/
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
const precss = require('precss');
const autoprefixer = require('autoprefixer');
module.exports = {
entry: './src/js/main.js',
output: {
path: './build',
publicPath: '/',
filename: 'js/bundle.js'
},
devtool: 'source-map',
// devServer: {
// historyApiFallback: true
// },
// hot: true,
module: {
loaders: [{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015'],
plugins: ['transform-object-rest-spread']
}
}, {
test: /\.scss$|\.css$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style',
loader: 'css?sourceMap!postcss-loader!sass?sourceMap'
})
}, {
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
}, {
test: /\.(ttf|otf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?|(jpg|gif)$/,
loader: 'file-loader'
}, {
test: /\.png$/,
loader: 'url-loader?limit=100000'
}, {
test: /\.jpg$/,
loader: 'file-loader'
}, {
test: /\.gif/,
loader: 'file-loader'
}, {
test: /\.html$/,
loader: 'raw-loader'
}]
},
plugins: [
new CopyWebpackPlugin([{
from: './src/index.html'
}, {
from: './src/img',
to: 'img'
}]),
new ExtractTextPlugin('style/bundle.css'),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"development"'
}
})
],
postcss: function () {
return [precss, autoprefixer];
}
};