-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
129 lines (108 loc) · 3.58 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*--------------------------------------------------------------------------------------------------------------------*/
const PACKAGE = require('./package.json');
/*--------------------------------------------------------------------------------------------------------------------*/
const BANNER = `AMI MQTT Client ${PACKAGE.version}
Copyright © 2021-${new Date().getFullYear()} CNRS/LPSC
Author: Jérôme ODIER ([email protected])
Repositories: https://gitlab.in2p3.fr/ami-team/AMIMQTTClientJS/
https://www.github.com/ami-team/AMIMQTTClientJS/
This software is a computer program whose purpose is to provide an
MQTT Client to the ATLAS Metadata Interface (AMI) ecosystem.
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/or redistribute the software under the terms of the CeCILL-C
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms.
`
/*--------------------------------------------------------------------------------------------------------------------*/
const BROWSER_LIST = [
'>= 1%',
'last 1 major version',
'not dead',
'Chrome >= 45',
'Firefox >= 38',
'Edge >= 12',
'Explorer >= 10',
'iOS >= 9',
'Safari >= 9',
'Android >= 4.4',
'Opera >= 30'
];
/*--------------------------------------------------------------------------------------------------------------------*/
console.log('Building AMI MQTT Client for: ' + BROWSER_LIST.join(', '));
/*--------------------------------------------------------------------------------------------------------------------*/
const path = require('path');
const webpack = require('webpack');
const JsDocPlugin = require('jsdoc-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
/*--------------------------------------------------------------------------------------------------------------------*/
module.exports = {
'entry': {
/* 'ami-mqtt-client': path.resolve(__dirname, 'src/client.js'),
*/ 'ami-mqtt-client.min': path.resolve(__dirname, 'src/client.js')
},
'output': {
'path': path.resolve(__dirname, 'dist'),
'filename': '[name].js'
},
'module': {
'rules': [
/*--------------------------------------------------------------------------------------------------------*/
{
'test': /\.js$/,
'exclude': /node_modules/,
'use': [
{
'loader': 'string-replace-loader',
'options': {
'search': '{{VERSION}}',
'replace': PACKAGE.version,
'flags': 'g'
}
},
{
'loader': 'babel-loader',
'options': {
'comments': false,
'compact': false,
'minified': false,
'presets': [
['@babel/preset-env', {
'targets': {
'browsers': BROWSER_LIST
}
}]
]
}
}
]
}
/*--------------------------------------------------------------------------------------------------------*/
]
},
'plugins': [
new JsDocPlugin({
'conf': '.jsdocrc.json',
'cwd': '.'
}),
new ESLintPlugin({
'failOnWarning': true
}),
new webpack.BannerPlugin({
'banner': BANNER
})
],
'optimization': {
'minimizer': [
new TerserPlugin({
'test': /\.min\.js$/,
'parallel': true,
'extractComments': false,
})
]
}
};
/*--------------------------------------------------------------------------------------------------------------------*/