-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
67 lines (64 loc) · 1.41 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
var webpack = require('webpack');
module.exports = {
context: __dirname,
entry: "app/main.js",
output: {
path: __dirname + "/dist",
// libraryTarget: 'var',
// library: "RTChat_LiarsDice",
filename: "bundle.js"
},
resolve: { alias: {
app: __dirname + '/app',
views: 'app/views',
utils: 'app/utils',
styles: 'app/styles',
node_modules: __dirname +'/node_modules',
} },
externals: {
// Use the jquery from RTChat so it's has bootstrap, etc.
'jquery': "RTChat.jQuery",
'rivets': "RTChat.Rivets",
},
plugins: [
new webpack.ProvidePlugin({
// These become available to all files.
$: "jquery",
_: "underscore",
Rivets: "rivets",
}),
],
module: {
loaders: [
{ test: /\.json$/, loader: "hson" },
{ test: /\.s?css$/, loaders: ["style", "css?sourceMap", "sass"] },
{ // ES6 support.
test: /\.js$/,
loader: "babel",
exclude: /node_modules/,
query: { presets: ['es2015'] }
},
],
preLoaders: [
{ test: /\.js$/, loader: 'jshint', exclude: /node_modules/ },
]
},
jshint: {
esversion: 6,
},
devtool: 'source-map',
};
if (process.argv.indexOf('--minify') >= 0) {
var CompressionPlugin = require("compression-webpack-plugin");
module.exports.plugins.concat([
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {warnings: false}
}),
new CompressionPlugin({
test: /\.js$/,
algorithm: "gzip",
asset: "[path].gz[query]"
})
]);
}