forked from strophe/strophejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
66 lines (63 loc) · 2.01 KB
/
webpack.config.js
File metadata and controls
66 lines (63 loc) · 2.01 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
55
56
57
58
59
60
61
62
63
64
65
66
/*global path, __dirname, module, process */
'use strict'
const minimist = require('minimist');
const path = require('path');
const webpack = require('webpack');
const config = {
entry: path.resolve(__dirname, 'src/strophe.js'),
externals: [{
"window": "window"
}],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'strophe.js',
library: 'strophe',
libraryExport: 'default',
libraryTarget: 'umd'
},
devtool: 'source-map',
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules|tests)/,
use: {
loader: 'babel-loader',
options: {
presets: [
["@babel/preset-env", {
"targets": {
"browsers": [">1%"]
}
}]
]
}
}
}],
},
resolve: {
extensions: ['.js'],
modules: [
'node_modules',
path.resolve(__dirname, "src")
],
alias: {
"es6-promise": path.resolve(__dirname, "node_modules/es6-promise/dist/es6-promise.auto"),
"strophe-bosh": path.resolve(__dirname, "src/bosh"),
"strophe-core": path.resolve(__dirname, "src/core"),
"strophe-md5": path.resolve(__dirname, "src/md5"),
"strophe-sha1": path.resolve(__dirname, "src/sha1"),
"strophe-utils": path.resolve(__dirname, "src/utils"),
"strophe-websocket": path.resolve(__dirname, "src/websocket")
}
}
}
function parameterize () {
const mode = minimist(process.argv.slice(2)).mode;
if (mode === 'production') {
console.log("Making a production build");
const fn = config.output.filename;
config.output.filename = `${fn.replace(/\.js$/, '')}.min.js`;
}
}
parameterize();
module.exports = config;