-
Notifications
You must be signed in to change notification settings - Fork 61
/
webpack.config.npm.js
80 lines (75 loc) · 1.92 KB
/
webpack.config.npm.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
77
78
79
80
var Webpack = require("webpack");
var path = require("path");
var fs = require("fs");
var babelConfigFilePath = path.resolve(__dirname, ".babelrc");
var babelConfig = JSON.parse(fs.readFileSync(babelConfigFilePath));
babelConfig.cacheDirectory = true;
function getPluginConfig() {
return [
// new Webpack.optimize.DedupePlugin(),
// new Webpack.optimize.AggressiveMergingPlugin(),
new Webpack.optimize.UglifyJsPlugin({
sourceMap: false,
compress: {
sequences: true,
dead_code: true,
conditionals: true,
booleans: true,
unused: true,
if_return: true,
join_vars: true,
// drop_console: true
},
output: {
comments: false
}
})
];
}
var moduleConfig = {
loaders: [
{
test: /\.(js)$/,
loader: "babel-loader",
query: babelConfig
}
]
};
module.exports = [
{
name: "all",
entry: "./src/force.js",
output: {
path: "./all",
filename: "index.js",
library: "force",
libraryTarget: "umd"
},
module: moduleConfig,
plugins: getPluginConfig()
},
{
name: "oauth",
entry: "./src/oauth.js",
output: {
path: "./oauth",
filename: "index.js",
library: ["force", "OAuth"],
libraryTarget: "umd"
},
module: moduleConfig,
plugins: getPluginConfig()
},
{
name: "dataservice",
entry: "./src/data-service.js",
output: {
path: "./data-service",
filename: "index.js",
library: ["force", "DataService"],
libraryTarget: "umd"
},
module: moduleConfig,
plugins: getPluginConfig()
}
];