-
Notifications
You must be signed in to change notification settings - Fork 15
/
rollup.config.js
51 lines (46 loc) · 1.14 KB
/
rollup.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
import fs from 'fs';
import path from 'path';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
import resolve from 'rollup-plugin-node-resolve';
import builtins from 'rollup-plugin-node-builtins';
import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
const { version, license, name } = require('./package.json');
const licenseData = fs.readFileSync(path.join(process.cwd(), 'LICENSE.md'), {
encoding: 'utf-8',
});
const bannerPlugin = {
banner: `/**
* @license ${name} ${version}
* ${licenseData.split('\n', 1)}
* License: ${license}
*/`,
};
const exportFormat = format => ({
input: 'src/webrtc-wowza-player.ts',
output: {
name,
format,
file: `dist/${format}/wowza-webrtc-player.js`,
},
plugins: [
builtins(),
resolve({
extensions: ['.ts'],
}),
babel({
extensions: ['ts'],
exclude: 'node_modules/**',
}),
bannerPlugin,
terser({
toplevel: true,
compress: {
unsafe: true,
},
output: { comments: /@license/ },
}),
sizeSnapshot(),
].filter(v => v),
});
export default ['umd', 'cjs', 'esm'].map(exportFormat);