-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
82 lines (78 loc) · 1.83 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
79
80
81
82
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
//Auto prefixing for our CSS
var autoprefixer = require('autoprefixer');
var precss = require('precss');
console.log(__dirname);
module.exports = {
entry: [
'webpack-dev-server/client?http://0.0.0.0:3000', // WebpackDevServer host and port
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
'./src/index'
],
devtool: 'eval',
resolve: {
extensions: [
'', '.js', '.jsx',
'.css', '.styl', '.scss', '.less', '.sass'
],
alias: {
}
},
output:{
path: __dirname + '/dist/js',
publicPath: '/js',
filename: "app.js",
pathinfo: true
},
module: {
loaders:[
//JSX
{
test: /\.jsx$/,
exclude: /(node_modules)/,
loaders: ['react-hot','babel']
},
//JS
{
test: /\.js$/,
exclude: /(node_modules)/,
loaders: ['react-hot','babel']
},
//CSS
{
test: /\.(scss|.css)$/,
exclude: /(node_modules)/,
loader: 'style!css!postcss-loader!sass'
},
//Fonts
{
test: /\.(woff|woff2)$/,
loader: "url?limit=10000&mimetype=application/font-woff"
},
{
test: /\.ttf$/,
loader: "url?limit=10000&mimetype=application/octet-stream"
},
{
test: /\.eot$/,
loader: "file"
},
//Images
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: "url?limit=25000"
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new HtmlWebpackPlugin({
template: 'underscore-template-loader!./html/index_template.html',
title: 'React Starter',
inject: 'body',
filename: '../index.html'
})
]
}