-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
54 lines (49 loc) · 1.4 KB
/
webpack.config.js
File metadata and controls
54 lines (49 loc) · 1.4 KB
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
var path = require('path');
var webpack = require('webpack');
var Clean = require('clean-webpack-plugin');
var PROD = (process.env.PROD);
var config = {
entry: {
index: './js/index',
vendor: ['jquery', 'backbone', 'backbone.marionette', 'dustjs', 'bluebird', resolvePath('/js/helpers/dustMarionetteHelper'), resolvePath('/less/bootstrap.less')]
},
output: {
path: path.join(__dirname, '/assets'),
filename: '[name].bundle.js',
publicPath: '/assets/'
},
resolve: {
root: [path.resolve('./js'), path.resolve('./js/modules'), path.resolve('./less')],
extensions: ['', '.js'],
alias: {
underscore: 'lodash',
dustjs: 'dustjs-linkedin'
}
},
module: {
loaders: [
{test: /\.js$/, loader: 'babel', exclude: /node_modules/},
{test: /\.css$/, loader: 'style!css'},
{test: /\.less$/, loader: 'style!css!autoprefixer!less'},
{test: /\.handlebars/, loader: 'handlebars'},
{test: /\.dust/, loader: 'dust-loader-complete'}
]
},
plugins: [
new Clean(['assets']),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js')
],
devServer: {
contentBase: './assets',
hot: true,
inline: true,
noInfo: true
}
};
if(PROD) {
config.plugins.push(new webpack.optimize.UglifyJsPlugin({minimize: true}));
}
module.exports = config;
function resolvePath(filePath) {
return path.join(__dirname, filePath);
}