-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
41 lines (37 loc) · 1007 Bytes
/
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
const path = require('path');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const binConfig = {
mode: 'production',
entry: path.resolve(__dirname, 'src/cli.js'),
target: 'node',
externals: [nodeExternals()],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'cli2compose.bin.js'
},
plugins: [
new webpack.BannerPlugin({ banner: "#!/usr/bin/env node", raw: true })
]
};
const nodeConfig = {
mode: 'production',
entry: path.resolve(__dirname, 'src/index.js'),
target: 'node',
externals: [nodeExternals()],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'cli2compose.node.js',
libraryTarget: 'commonjs2',
}
};
const browserConfig = {
mode: 'production',
entry: path.resolve(__dirname, 'src/browser.js'),
target: 'web',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'cli2compose.browser.js'
}
};
module.exports = [ nodeConfig, browserConfig, binConfig ];