forked from jerrysu/backbone-webpack-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
83 lines (71 loc) · 2.48 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
83
'use strict';
var webpack = require('webpack');
module.exports = {
// Entry point for static analyzer
entry: {
app: [
'webpack-dev-server/client?http://localhost:8081',
'webpack/hot/dev-server',
'./js/main.js'
]
},
output: {
// Where to build results
path: __dirname + '/assets',
// Filename to use in HTML
filename: 'bundle.js',
// Path to use in HTML
publicPath: '/assets/'
},
resolve: {
// Absolute path that contains modules
root: __dirname,
// Directory names to be searched for modules
modulesDirectories: ['js', 'views', 'node_modules'],
// Replace modules with other modules or paths for compatibility or convenience
alias: {
'React': 'react/addons',
'underscore': 'lodash'
}
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
module: {
preLoaders: [
{test: /\.jsx$/, loader: 'eslint', exclude: /node_modules/},
],
loaders: [
{test: /\.jsx?$/, loaders: ['react-hot', 'babel?experimental&blacklist[]=validation.react'], exclude: /node_modules/},
{test: /\.scss$/, loaders: ['style', 'css', 'autoprefixer', 'sass']},
{test: /\.css$/, loaders: ['style', 'css', 'autoprefixer']},
{test: /\.json$/, loaders: ['json']},
{test: /\.png$/, loader: 'url?limit=8192&mimetype=image/png'},
{test: /\.jpe?g$/, loader: 'url?limit=8192&mimetype=image/jpg'},
{test: /\.gif$/, loader: 'url?limit=8192&mimetype=image/gif'},
{test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=8192&mimetype=image/svg+xml'},
{test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=8192&mimetype=application/font-woff2'},
{test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=8192&mimetype=application/font-woff'},
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=8192&mimetype=application/octet-stream'},
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file'},
{test: /\.md$/, loaders: ['html', 'markdown']}
]
},
devtool: '#inline-source-map',
eslint: {
emitErrors: true,
reporter: function(results) {
return results.map(function(result) {
return result.messages.map(function(msg) {
return (
' ' + msg.message + '(' + msg.ruleId + ')' +
' @ line ' + msg.line + ' column ' + msg.column +
' - ' +
(msg.fatal ? 'fatal, ' : '') +
'severity: ' + msg.severity
);
}).join('\n');
}).join('\n');
}
}
};