forked from webex/react-widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.calling-config.js
76 lines (72 loc) · 1.99 KB
/
rollup.calling-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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import babel from 'rollup-plugin-babel';
import url from '@rollup/plugin-url';
import clear from 'rollup-plugin-clear';
import postcss from 'rollup-plugin-postcss';
import localResolve from 'rollup-plugin-local-resolve';
import {base64} from '@webex/common';
export default {
plugins: [
// Clears the destination directory before building
clear({
// required, point out which directories should be clear.
targets: ['es']
}),
// Finds the index.js file when importing via folder
localResolve(),
// Convert css to css modules
postcss({
modules: {
generateScopedName: (name, filename, css) => {
const cssHash = base64.encode(css).substring(0, 8);
const paths = filename.split('/');
const index = paths.indexOf('widget-call-history');
let componentName;
if (index !== -1) {
componentName = paths[index + 1];
}
else {
componentName = filename;
}
return `${componentName}__${name}__${cssHash}`;
}
},
// Don't use sass loader due to momentum-ui issues
use: [],
config: false
}),
// Inline images
url({
limit: 100 * 1024 // inline files < 100k, copy files > 100k
}),
// Audio files for ringtones
url({
limit: 0,
include: ['**/*.mp3']
}),
babel({
babelrc: false,
exclude: 'node_modules/**',
plugins: [
[
// Support for @autobind decorators
'@babel/plugin-proposal-decorators',
{
legacy: true
}
],
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining'
],
presets: [
'@babel/preset-react'
]
})
],
input: 'src/index.ts',
output: [{
dir: 'es',
format: 'esm',
sourcemap: true
}],
external: ['react', 'react-dom', 'prop-types', 'classnames', '@momentum-ui/react', '@momentum-ui/react-collaboration']
};