forked from dailymotion/vast-client-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
51 lines (47 loc) · 1.27 KB
/
webpack.config.js
File metadata and controls
51 lines (47 loc) · 1.27 KB
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
const path = require('path');
module.exports = env => {
const config = {
mode: 'production',
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['babel-preset-es2015'],
plugins: ['transform-object-assign']
}
}
}
]
},
resolve: {
alias: {}
}
};
// Bundle non-minified version of the library
if (env === 'dev' || env === 'node-dev') {
config.mode = 'development';
}
// Options for node bundling
if (env === 'node' || env === 'node-dev') {
config.target = 'node';
config.output.filename =
env === 'node-dev' ? 'vast-client-node.js' : 'vast-client-node.min.js';
config.output.libraryTarget = 'umd';
// Options for node bundling by default we should not import the node url handler
config.resolve.alias['./urlhandlers/mock_node_url_handler'] =
'./urlhandlers/node_url_handler';
} else {
config.output.filename =
env === 'dev' ? 'vast-client.js' : 'vast-client.min.js';
config.output.library = 'VAST';
}
return config;
};