-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
59 lines (56 loc) · 1.67 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
const path = require('path');
const webpack = require('webpack');
const sharedConfig = {
plugins: [
new webpack.DefinePlugin({
__PLUGIN_VERSION_TIMESTAMP__: webpack.DefinePlugin.runtimeValue(() => `${new Date().valueOf()}`, true),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.DEBUG': JSON.stringify(process.env.DEBUG)
}),
],
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, 'build/src/')
],
},
}
const sharedNodeConfig = {
...sharedConfig,
target: 'node',
node: {
__dirname: false,
__filename: false,
},
externals: {
argparse: 'require("argparse")',
'util.promisify': 'require("util.promisify")',
},
plugins: [
...sharedConfig.plugins,
new webpack.BannerPlugin({ banner: "#!/usr/bin/env node", raw: true, entryOnly: true }),
],
}
module.exports = [
{
node: false,
entry: path.resolve(__dirname, `build/src/ciftools.js`),
output: {
library: 'CIFTools',
libraryTarget: 'umd',
filename: `ciftools.js`,
path: path.resolve(__dirname, `build/dist`)
},
...sharedConfig
},
{
...sharedNodeConfig,
entry: path.resolve(__dirname, `build/src/apps/cif2bcif/index.js`),
output: { filename: `cif2bcif.js`, path: path.resolve(__dirname, `build/bin`) },
},
{
...sharedNodeConfig,
entry: path.resolve(__dirname, `build/src/apps/cifschema/index.js`),
output: { filename: `cifschema.js`, path: path.resolve(__dirname, `build/bin`) },
}
]