-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.common.js
69 lines (68 loc) · 1.71 KB
/
webpack.common.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
const CreateFileWebpack = require('create-file-webpack');
const npmPackage = require('./package.json');
const path = require('path');
module.exports = {
entry: './src/ts/index.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: {
loader: 'ts-loader',
options: {
configFile: 'tsconfig.build.json'
}
},
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
loader: 'string-replace-loader',
options: {
search: '{{VERSION}}',
replace: npmPackage.version,
flags: 'g'
}
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: 'bitmovin-player-analytics-conviva.js',
umdNamedDefine: true,
path: path.resolve(__dirname, 'dist'),
library: {
root: ['bitmovin', 'player', 'analytics'],
amd: 'bitmovin-player-analytics-conviva',
commonjs: 'bitmovin-player-analytics-conviva'
},
libraryTarget: 'umd'
},
devtool: 'source-map',
plugins: [
new CreateFileWebpack({
// path to folder in which the file will be created
path: './dist',
// file name
fileName: 'bitmovin-player-analytics-conviva.d.ts',
// content of the file
content: 'export * from \'./lib/index\';'
}),
],
externals: {
'@convivainc/conviva-js-coresdk': {
commonjs: '@convivainc/conviva-js-coresdk',
commonjs2: '@convivainc/conviva-js-coresdk',
amd: '@convivainc/conviva-js-coresdk',
root: ['Conviva']
},
'bitmovin-player': {
commonjs: 'bitmovin-player',
commonjs2: 'bitmovin-player',
amd: 'bitmovin-player',
root: ['bitmovin', 'player']
}
}
};