forked from fullcalendar/fullcalendar-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
55 lines (50 loc) · 1.26 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
52
53
54
55
import resolve from 'rollup-plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import packageConfig from './package.json'
/*
Will generate a UMD by default but can be instructed to generate an ES module
by using command line argument overrides.
*/
const BROWSER_GLOBAL = 'FullCalendarVue'
const EXTERNAL_BROWSER_GLOBALS = {
'@fullcalendar/core': 'FullCalendar'
}
const OUTPUT_SETTINGS = {
umd: {
format: 'umd',
file: 'dist/main.umd.js',
exports: 'named',
name: BROWSER_GLOBAL,
globals: EXTERNAL_BROWSER_GLOBALS,
banner: buildBanner
},
esm: {
format: 'es',
file: 'dist/main.esm.js',
banner: buildBanner
}
}
export default [
buildSettings('umd'),
buildSettings('esm')
]
function buildSettings(format) {
return {
input: 'src/wrapper.js',
output: OUTPUT_SETTINGS[format],
external: Object.keys(EXTERNAL_BROWSER_GLOBALS),
plugins: [
resolve({
jail: 'src' // any files outside of here are considered external libs
}),
babel() // will automatically use babel.config.js
]
}
}
function buildBanner() {
return '/*\n' +
packageConfig.title + ' v' + packageConfig.version + '\n' +
'Docs: ' + packageConfig.docs + '\n' +
'License: ' + packageConfig.license + '\n' +
'*/'
}