-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
69 lines (61 loc) · 1.72 KB
/
webpack.config.babel.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
import path from 'path';
import webpack from 'webpack';
import yargs from 'yargs';
import pkg from './package';
const { optimizeMinimize } = yargs.alias('p', 'optimize-minimize').argv;
const nodeEnv = optimizeMinimize ? 'production' : 'development';
const commonConfig = {
module: {
rules: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/, options: { babelrcRoots: ['.', '../'] } }
]
},
externals: [],
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(nodeEnv),
'__PACKAGE_VERSION__': JSON.stringify(pkg.version),
'__BUILD_TIME__': JSON.stringify(new Date().toISOString())
}
})
],
devtool: optimizeMinimize ? 'source-map' : false
};
const nodeConfig = Object.assign({}, commonConfig, {
entry: {
'FIXParser': './src/FIXParser.js'
},
output: {
path: path.join(__dirname),
filename: 'fixparser.js',
library: 'FIXParser',
libraryTarget: 'umd'
},
target: 'node'
});
const serverConfig = Object.assign({}, commonConfig, {
entry: {
'FIXParser': './src/FIXServer.js'
},
output: {
path: path.join(__dirname),
filename: 'server.js',
library: 'FIXParser',
libraryTarget: 'umd'
},
target: 'node'
});
const browserConfig = Object.assign({}, commonConfig, {
entry: {
'FIXParser': './src/FIXParserBrowser.js'
},
output: {
path: path.join(__dirname),
filename: 'browser.js',
library: 'FIXParser',
libraryTarget: 'umd'
},
target: 'web'
});
export default [ nodeConfig, serverConfig, browserConfig ];