-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
63 lines (59 loc) · 1.75 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
/* global __dirname */
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var dir_js = path.resolve(__dirname, 'app');
var dir_build = path.resolve(__dirname, 'public');
module.exports = {
entry: {
app : path.resolve(dir_js, '../index.js'),
vendor : ['react', 'react-dom']
},
devtool: 'source-map',
output: {
path: dir_build,
filename: 'bundle.js'
},
resolve: {
modulesDirectories: ['node_modules', dir_js],
},
devServer: {
contentBase: dir_build,
},
postcss: function () {
return [require('autoprefixer')];
},
module: {
loaders: [
{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/,
presets : ['es2015', 'react']
},
{
test : /\.html$/,
loader : 'file?name=[name].html'
},
{
test: /\.sass($|\?)|\.scss($|\?)|\.css($|\?)/,
//loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
loader: ExtractTextPlugin.extract("style-loader", "css-loader!postcss-loader!sass?sourceMap")
},
{
//exclude: /node_modules/,
test: /\.png($|\?)|\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/,
loader: 'file?name=assets/[name].[ext]'
}
]
},
plugins: [
new ExtractTextPlugin("[name].css"),
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.js"),
new webpack.NoErrorsPlugin()
],
stats: {
// Nice colored output
colors: true
}
}