forked from LHNCBC/ucum-lhc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
47 lines (43 loc) · 1.19 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
// Currently this is used to build the two programs in the impexp directory
// (which need access to local files, and were difficult (if not impossible) to
// build using browserify).
const path = require('path');
function commonConfig() {
return {
target: 'node',
mode: 'development',
output: {
path: __dirname,
library: 'ucum'
},
module: {
rules: [
{
test: /\.m?js$/,
// exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env' ]],
plugins: ["@babel/plugin-transform-modules-commonjs", "@babel/plugin-proposal-class-properties"]
}
}
}
]
}
}
}
var configs = [];
var progConfig = commonConfig();
progConfig.entry = path.join(__dirname, './impexp/updateData.js');
progConfig.externals = [
function ({context, request}, callback) {
if(/ucumDefs\.json/.test(request)) {
return callback(null, 'commonjs ' + request);
}
callback();
}
];
progConfig.output.filename = './impexp/updateDataBuild.js';
configs.push(progConfig);
module.exports = configs;