-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrollup.config.js
49 lines (42 loc) · 1.3 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
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
let pkg = require('./package.json');
let banner = `/**
* ${pkg.description}
* @version v${pkg.version}
* @link ${pkg.homepage}
* @license MIT License, http://www.opensource.org/licenses/MIT
*/`;
let plugins = [nodeResolve(), commonjs()];
// Suppress this error message... there are hundreds of them. Angular team says to ignore it.
// https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
function onwarn(warning) {
if (warning.code === 'THIS_IS_UNDEFINED') return;
console.error(warning.message);
}
function isExternal(id) {
// @uirouter/core and rxjs should be external
let externals = [/^rxjs\/?/, /\/rxjs\//, /^@uirouter\/.*/];
let isExternal = externals.map(regex => regex.exec(id)).reduce((acc, val) => acc || !!val, false);
// console.log(id, isExternal);
return isExternal;
}
const CONFIG = {
input: 'lib-esm/index.js',
output: {
file: '_bundles/ui-router-rx.js',
name: '@uirouter/rx',
globals: {
'@uirouter/core': '@uirouter/core',
'@uirouter/rx': '@uirouter/rx',
},
sourcemap: true,
banner: banner,
format: 'umd',
exports: 'named',
},
plugins: plugins,
onwarn: onwarn,
external: isExternal,
};
export default CONFIG;