forked from focus-trap/focus-trap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
33 lines (32 loc) · 979 Bytes
/
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
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import modify from 'rollup-plugin-modify';
export default [
{
input: 'index.js',
output: {
file: 'dist/focus-trap.mjs',
format: 'esm'
},
plugins: [
modify({
// swap tababble require load to ES6 import
"var tabbable = require('tabbable');":
"import tabbable from 'tabbable';",
// ES6 module support implicitly means Object.assign support, so xtend can drop out
"var xtend = require('xtend');": '',
'xtend(': 'Object.assign(',
// swap focus-trap from node module.exports to ES6 named export
'function focusTrap(': 'export function focusTrap(',
'module.exports = focusTrap;': ''
}),
resolve(),
commonjs({
include: [
// tabbable is not an ES6 module, so bundle it
'node_modules/tabbable/index.js'
]
})
]
}
];