forked from codeschool/silo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
72 lines (62 loc) · 1.59 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
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var autoprefixer = require('autoprefixer');
module.exports = {
context: __dirname,
entry: path.join(__dirname, 'src/index'),
output: {
path: path.resolve('./dist/'),
filename: "[name]-[hash].js",
},
plugins: [
new webpack.NoErrorsPlugin(),
new ExtractTextPlugin('[name]-[hash].css'),
new HtmlWebpackPlugin({
title: 'React Hack Night',
template: path.join(__dirname, 'src/index.html'),
inject: 'body'
}),
// http://stackoverflow.com/questions/30030031/passing-environment-dependent-variables-in-webpack
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
}),
],
module: {
loaders: [
{
// to transform JSX into JS
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel']
},
{
test: /\.scss$/,
exclude: /node_modules/,
loader: ExtractTextPlugin.extract(
'css!' +
'postcss!' +
'sass?sourceMap'
)
},
],
},
sassLoader: {
includePaths: [path.resolve(__dirname, './node_modules')]
},
postcss: [
autoprefixer({
browsers: ['ios >= 7']
})
],
devtool: process.env.NODE_ENV === 'development' && 'inline-source-map',
resolve: {
modulesDirectories: ['node_modules'],
extensions: ['', '.js']
},
watchOptions: {
poll: true,
polling: 1000
}
}