-
Notifications
You must be signed in to change notification settings - Fork 14
/
webpack.config.js
76 lines (64 loc) · 1.38 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
var fs = require('fs');
var url = require('url');
var path = require('path');
var webpack = require('webpack');
var DEBUG = !process.argv.production;
var GLOBALS = {
'process.env.NODE_ENV': DEBUG ? '"development"' : '"production"',
'__DEV__': DEBUG
};
module.exports = {
// Main entry directory and file
entry: {
app: [
// 'webpack/hot/dev-server',
path.join(__dirname, 'app', 'main.js')
]
},
// Output directories and file
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
chunkFilename: '[name].chunk.js',
publicPath: '/durandal-webpack/dist/'
},
// Custom plugins
plugins: [
new webpack.DefinePlugin(GLOBALS),
new webpack.optimize.OccurenceOrderPlugin()
]
.concat(DEBUG ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.AggressiveMergingPlugin()
]),
module: {
loaders: [
{ test: /\.html$/, loader: 'html' },
{ test: /\.json$/, loader: 'json' }
]
},
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
modulesDirectories: [
'node_modules',
'app'
],
root: path.join(__dirname, 'app'),
alias: {
durandal: 'durandal/js',
plugins: 'durandal/js/plugins'
}
},
externals: {
jquery: 'jQuery'
},
devServer: {
contentBase: __dirname,
hot: false,
inline: true,
historyApiFallback: true,
stats: { colors: true },
progress: true
}
};