-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.config.js
58 lines (51 loc) · 1.36 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
"use strict";
var webpack = require("webpack");
module.exports = function(env) {
var plugins = [];
var outputFile = "./lib/labelgun.js";
if (env && env.minified) {
outputFile = "./lib/labelgun.min.js";
plugins.push(new webpack.optimize.UglifyJsPlugin({
sourceMap: true
}));
}
var config = {
context: __dirname,
// entry is the "main" source file we want to include/import
entry: "./src/labelgun.js",
// output tells webpack where to put the bundle it creates
output: {
// in the case of a "plain global browser library", this
// will be used as the reference to our module that is
// hung off of the window object.
library: "labelgun",
// We want webpack to build a UMD wrapper for our module
libraryTarget: "umd",
// the destination file name
filename: outputFile
},
plugins: plugins,
// externals let you tell webpack about external dependencies
// that shouldn't be resolved by webpack.
externals: [
{
rbush: "rbush"
}
],
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
presets: ["env"]
}
}
}
]
}
}; // End of config
return config;
};