-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
48 lines (39 loc) · 1.01 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
import typescript from '@rollup/plugin-typescript';
import pkg from './package.json';
function getAuthors() {
const { contributors, author } = pkg;
const authors = new Set();
if (contributors) {
contributors.forEach((contributor) => {
authors.add(contributor.name);
});
}
if (author) authors.add(author.name);
return Array.from(authors).join(', ');
}
const banner = `/*!
* ${pkg.name} v${pkg.version}
* (c) ${new Date().getFullYear()} ${getAuthors()}
* @license ${pkg.license}
*/`;
const name = 'vuecloak';
const globals = {
'keycloak-js': 'Keycloak',
};
const outputConfigs = {
cjs: pkg.main,
es: pkg.module,
umd: pkg.browser,
};
const outputFormats = Object.keys(outputConfigs);
function createOutput(file, format) {
return {
file, format, banner, name, globals,
};
}
export default {
input: 'src/index.ts',
output: outputFormats.map((format) => createOutput(outputConfigs[format], format)),
external: ['keycloak-js', '@vue/devtools-api'],
plugins: [typescript()],
};