-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
73 lines (70 loc) · 1.89 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
var Webpack = require('webpack'),
path = require('path'),
pkg = require('./package.json');
var eslintrcPath = path.resolve(__dirname, '.eslintrc'),
nodeModulesPath = path.resolve(__dirname, 'node_modules'),
buildPath = path.resolve(__dirname, 'src', 'build'),
mainPath = path.resolve(__dirname, 'src', 'app.js');
var config = {
devtool: 'eval',
watch: true,
entry: {
app: [
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8080',
mainPath
],
vendors: pkg.vendors
},
output: {
path: buildPath,
filename: 'bundle.js',
publicPath: '/build/'
},
module: {
preLoaders: [
{
test: /\.js(x)?$/,
loader: 'eslint',
exclude: nodeModulesPath
}
],
loaders: [
{
test: /\.js(x)?$/,
loader: 'babel',
exclude: nodeModulesPath
},
{
test: /\.(css|scss)$/,
loaders: ['style', 'css', 'sass']
},
{
test: /\.(png|jpg|jpeg|gif|svg)$/,
loader: 'url?limit=8192'
},
{
test : /\.(woff|woff2|ttf|eot)$/,
loader: 'url'
}
]
},
plugins: [
new Webpack.HotModuleReplacementPlugin(),
new Webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
'root.jQuery': 'jquery'
}),
new Webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.bundle.js', Infinity),
new Webpack.NoErrorsPlugin()
],
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.scss']
},
eslint: {
configFile: eslintrcPath
}
};
module.exports = config;